<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
    <title>Coverage for cogapp/test_cogapp.py: 30.00%</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.hotkeys.js"></script>
    <script type="text/javascript" src="jquery.isonscreen.js"></script>
    <script type="text/javascript" src="coverage_html.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(coverage.pyfile_ready);
    </script>
</head>
<body class="pyfile">
<div id="header">
    <div class="content">
        <h1>Coverage for <b>cogapp/test_cogapp.py</b> :
            <span class="pc_cov">30.00%</span>
        </h1>
        <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" />
        <h2 class="stats">
            790 statements &nbsp;
            <button type="button" class="run shortkey_r button_toggle_run" title="Toggle lines run">241 run</button>
            <button type="button" class="mis show_mis shortkey_m button_toggle_mis" title="Toggle lines missing">549 missing</button>
            <button type="button" class="exc show_exc shortkey_x button_toggle_exc" title="Toggle lines excluded">6 excluded</button>
            <button type="button" class="par run show_par shortkey_p button_toggle_par" title="Toggle lines partially run">0 partial</button>
        </h2>
    </div>
</div>
<div class="help_panel">
    <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" />
    <p class="legend">Hot-keys on this page</p>
    <div>
    <p class="keyhelp">
        <span class="key">r</span>
        <span class="key">m</span>
        <span class="key">x</span>
        <span class="key">p</span> &nbsp; toggle line displays
    </p>
    <p class="keyhelp">
        <span class="key">j</span>
        <span class="key">k</span> &nbsp; next/prev highlighted chunk
    </p>
    <p class="keyhelp">
        <span class="key">0</span> &nbsp; (zero) top of page
    </p>
    <p class="keyhelp">
        <span class="key">1</span> &nbsp; (one) first highlighted chunk
    </p>
    </div>
</div>
<div id="source">
    <p id="t1" class="pln"><span class="n"><a href="#t1">1</a></span><span class="t"><span class="str">""" Test cogapp.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2" class="pln"><span class="n"><a href="#t2">2</a></span><span class="t"><span class="str">    http://nedbatchelder.com/code/cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t3" class="pln"><span class="n"><a href="#t3">3</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t4" class="pln"><span class="n"><a href="#t4">4</a></span><span class="t"><span class="str">    Copyright 2004-2019, Ned Batchelder.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t5" class="pln"><span class="n"><a href="#t5">5</a></span><span class="t"><span class="str">"""</span>&nbsp;</span><span class="r"></span></p>
    <p id="t6" class="pln"><span class="n"><a href="#t6">6</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t7" class="run"><span class="n"><a href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">__future__</span> <span class="key">import</span> <span class="nam">absolute_import</span>&nbsp;</span><span class="r"></span></p>
    <p id="t8" class="pln"><span class="n"><a href="#t8">8</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t9" class="run"><span class="n"><a href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span>&nbsp;</span><span class="r"></span></p>
    <p id="t10" class="run"><span class="n"><a href="#t10">10</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span>&nbsp;</span><span class="r"></span></p>
    <p id="t11" class="run"><span class="n"><a href="#t11">11</a></span><span class="t"><span class="key">import</span> <span class="nam">random</span>&nbsp;</span><span class="r"></span></p>
    <p id="t12" class="run"><span class="n"><a href="#t12">12</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span>&nbsp;</span><span class="r"></span></p>
    <p id="t13" class="run"><span class="n"><a href="#t13">13</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span>&nbsp;</span><span class="r"></span></p>
    <p id="t14" class="run"><span class="n"><a href="#t14">14</a></span><span class="t"><span class="key">import</span> <span class="nam">stat</span>&nbsp;</span><span class="r"></span></p>
    <p id="t15" class="run"><span class="n"><a href="#t15">15</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span>&nbsp;</span><span class="r"></span></p>
    <p id="t16" class="run"><span class="n"><a href="#t16">16</a></span><span class="t"><span class="key">import</span> <span class="nam">tempfile</span>&nbsp;</span><span class="r"></span></p>
    <p id="t17" class="run"><span class="n"><a href="#t17">17</a></span><span class="t"><span class="key">import</span> <span class="nam">threading</span>&nbsp;</span><span class="r"></span></p>
    <p id="t18" class="pln"><span class="n"><a href="#t18">18</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t19" class="run"><span class="n"><a href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">backward</span> <span class="key">import</span> <span class="nam">StringIO</span><span class="op">,</span> <span class="nam">to_bytes</span><span class="op">,</span> <span class="nam">TestCase</span><span class="op">,</span> <span class="nam">PY3</span>&nbsp;</span><span class="r"></span></p>
    <p id="t20" class="run"><span class="n"><a href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">cogapp</span> <span class="key">import</span> <span class="nam">Cog</span><span class="op">,</span> <span class="nam">CogOptions</span><span class="op">,</span> <span class="nam">CogGenerator</span>&nbsp;</span><span class="r"></span></p>
    <p id="t21" class="run"><span class="n"><a href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">cogapp</span> <span class="key">import</span> <span class="nam">CogError</span><span class="op">,</span> <span class="nam">CogUsageError</span><span class="op">,</span> <span class="nam">CogGeneratedError</span><span class="op">,</span> <span class="nam">CogUserException</span>&nbsp;</span><span class="r"></span></p>
    <p id="t22" class="run"><span class="n"><a href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">cogapp</span> <span class="key">import</span> <span class="nam">usage</span><span class="op">,</span> <span class="nam">__version__</span><span class="op">,</span> <span class="nam">main</span>&nbsp;</span><span class="r"></span></p>
    <p id="t23" class="run"><span class="n"><a href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">makefiles</span> <span class="key">import</span> <span class="op">*</span>&nbsp;</span><span class="r"></span></p>
    <p id="t24" class="run"><span class="n"><a href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">whiteutils</span> <span class="key">import</span> <span class="nam">reindentBlock</span>&nbsp;</span><span class="r"></span></p>
    <p id="t25" class="pln"><span class="n"><a href="#t25">25</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t26" class="pln"><span class="n"><a href="#t26">26</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t27" class="run"><span class="n"><a href="#t27">27</a></span><span class="t"><span class="key">class</span> <span class="nam">CogTestsInMemory</span><span class="op">(</span><span class="nam">TestCase</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t28" class="pln"><span class="n"><a href="#t28">28</a></span><span class="t">    <span class="str">""" Test cases for cogapp.Cog()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t29" class="pln"><span class="n"><a href="#t29">29</a></span><span class="t"><span class="str">    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t30" class="pln"><span class="n"><a href="#t30">30</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t31" class="run"><span class="n"><a href="#t31">31</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoCog</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t32" class="run"><span class="n"><a href="#t32">32</a></span><span class="t">        <span class="nam">strings</span> <span class="op">=</span> <span class="op">[</span>&nbsp;</span><span class="r"></span></p>
    <p id="t33" class="pln"><span class="n"><a href="#t33">33</a></span><span class="t">            <span class="str">''</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t34" class="pln"><span class="n"><a href="#t34">34</a></span><span class="t">            <span class="str">' '</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t35" class="pln"><span class="n"><a href="#t35">35</a></span><span class="t">            <span class="str">' \t \t \tx'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t36" class="pln"><span class="n"><a href="#t36">36</a></span><span class="t">            <span class="str">'hello'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t37" class="pln"><span class="n"><a href="#t37">37</a></span><span class="t">            <span class="str">'the cat\nin the\nhat.'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t38" class="pln"><span class="n"><a href="#t38">38</a></span><span class="t">            <span class="str">'Horton\n\tHears A\n\t\tWho'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t39" class="pln"><span class="n"><a href="#t39">39</a></span><span class="t">            <span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t40" class="run"><span class="n"><a href="#t40">40</a></span><span class="t">        <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">strings</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t41" class="run"><span class="n"><a href="#t41">41</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">s</span><span class="op">)</span><span class="op">,</span> <span class="nam">s</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t42" class="pln"><span class="n"><a href="#t42">42</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t43" class="run"><span class="n"><a href="#t43">43</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSimple</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t44" class="run"><span class="n"><a href="#t44">44</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t45" class="pln"><span class="n"><a href="#t45">45</a></span><span class="t"><span class="str">            Some text.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t46" class="pln"><span class="n"><a href="#t46">46</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t47" class="pln"><span class="n"><a href="#t47">47</a></span><span class="t"><span class="str">            import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t48" class="pln"><span class="n"><a href="#t48">48</a></span><span class="t"><span class="str">            cog.outl("This is line one\\n")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t49" class="pln"><span class="n"><a href="#t49">49</a></span><span class="t"><span class="str">            cog.outl("This is line two")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t50" class="pln"><span class="n"><a href="#t50">50</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t51" class="pln"><span class="n"><a href="#t51">51</a></span><span class="t"><span class="str">            gobbledegook.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t52" class="pln"><span class="n"><a href="#t52">52</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t53" class="pln"><span class="n"><a href="#t53">53</a></span><span class="t"><span class="str">            epilogue.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t54" class="pln"><span class="n"><a href="#t54">54</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t55" class="pln"><span class="n"><a href="#t55">55</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t56" class="run"><span class="n"><a href="#t56">56</a></span><span class="t">        <span class="nam">outfile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t57" class="pln"><span class="n"><a href="#t57">57</a></span><span class="t"><span class="str">            Some text.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t58" class="pln"><span class="n"><a href="#t58">58</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t59" class="pln"><span class="n"><a href="#t59">59</a></span><span class="t"><span class="str">            import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t60" class="pln"><span class="n"><a href="#t60">60</a></span><span class="t"><span class="str">            cog.outl("This is line one\\n")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t61" class="pln"><span class="n"><a href="#t61">61</a></span><span class="t"><span class="str">            cog.outl("This is line two")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t62" class="pln"><span class="n"><a href="#t62">62</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t63" class="pln"><span class="n"><a href="#t63">63</a></span><span class="t"><span class="str">            This is line one</span>&nbsp;</span><span class="r"></span></p>
    <p id="t64" class="pln"><span class="n"><a href="#t64">64</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t65" class="pln"><span class="n"><a href="#t65">65</a></span><span class="t"><span class="str">            This is line two</span>&nbsp;</span><span class="r"></span></p>
    <p id="t66" class="pln"><span class="n"><a href="#t66">66</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t67" class="pln"><span class="n"><a href="#t67">67</a></span><span class="t"><span class="str">            epilogue.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t68" class="pln"><span class="n"><a href="#t68">68</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t69" class="pln"><span class="n"><a href="#t69">69</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t70" class="run"><span class="n"><a href="#t70">70</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">outfile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t71" class="pln"><span class="n"><a href="#t71">71</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t72" class="run"><span class="n"><a href="#t72">72</a></span><span class="t">    <span class="key">def</span> <span class="nam">testEmptyCog</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t73" class="pln"><span class="n"><a href="#t73">73</a></span><span class="t">        <span class="com"># The cog clause can be totally empty.  Not sure why you'd want it,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t74" class="pln"><span class="n"><a href="#t74">74</a></span><span class="t">        <span class="com"># but it works.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t75" class="run"><span class="n"><a href="#t75">75</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t76" class="pln"><span class="n"><a href="#t76">76</a></span><span class="t"><span class="str">            hello</span>&nbsp;</span><span class="r"></span></p>
    <p id="t77" class="pln"><span class="n"><a href="#t77">77</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t78" class="pln"><span class="n"><a href="#t78">78</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t79" class="pln"><span class="n"><a href="#t79">79</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t80" class="pln"><span class="n"><a href="#t80">80</a></span><span class="t"><span class="str">            goodbye</span>&nbsp;</span><span class="r"></span></p>
    <p id="t81" class="pln"><span class="n"><a href="#t81">81</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t82" class="pln"><span class="n"><a href="#t82">82</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t83" class="run"><span class="n"><a href="#t83">83</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t84" class="run"><span class="n"><a href="#t84">84</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t85" class="pln"><span class="n"><a href="#t85">85</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t86" class="run"><span class="n"><a href="#t86">86</a></span><span class="t">    <span class="key">def</span> <span class="nam">testMultipleCogs</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t87" class="pln"><span class="n"><a href="#t87">87</a></span><span class="t">        <span class="com"># One file can have many cog chunks, even abutting each other.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t88" class="run"><span class="n"><a href="#t88">88</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t89" class="pln"><span class="n"><a href="#t89">89</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t90" class="pln"><span class="n"><a href="#t90">90</a></span><span class="t"><span class="str">            cog.out("chunk1")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t91" class="pln"><span class="n"><a href="#t91">91</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t92" class="pln"><span class="n"><a href="#t92">92</a></span><span class="t"><span class="str">            chunk1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t93" class="pln"><span class="n"><a href="#t93">93</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t94" class="pln"><span class="n"><a href="#t94">94</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t95" class="pln"><span class="n"><a href="#t95">95</a></span><span class="t"><span class="str">            cog.out("chunk2")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t96" class="pln"><span class="n"><a href="#t96">96</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t97" class="pln"><span class="n"><a href="#t97">97</a></span><span class="t"><span class="str">            chunk2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t98" class="pln"><span class="n"><a href="#t98">98</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t99" class="pln"><span class="n"><a href="#t99">99</a></span><span class="t"><span class="str">            between chunks</span>&nbsp;</span><span class="r"></span></p>
    <p id="t100" class="pln"><span class="n"><a href="#t100">100</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t101" class="pln"><span class="n"><a href="#t101">101</a></span><span class="t"><span class="str">            cog.out("chunk3")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t102" class="pln"><span class="n"><a href="#t102">102</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t103" class="pln"><span class="n"><a href="#t103">103</a></span><span class="t"><span class="str">            chunk3</span>&nbsp;</span><span class="r"></span></p>
    <p id="t104" class="pln"><span class="n"><a href="#t104">104</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t105" class="pln"><span class="n"><a href="#t105">105</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t106" class="pln"><span class="n"><a href="#t106">106</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t107" class="run"><span class="n"><a href="#t107">107</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t108" class="run"><span class="n"><a href="#t108">108</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t109" class="pln"><span class="n"><a href="#t109">109</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t110" class="run"><span class="n"><a href="#t110">110</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTrimBlankLines</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t111" class="run"><span class="n"><a href="#t111">111</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t112" class="pln"><span class="n"><a href="#t112">112</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t113" class="pln"><span class="n"><a href="#t113">113</a></span><span class="t"><span class="str">            cog.out("This is line one\\n", trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t114" class="pln"><span class="n"><a href="#t114">114</a></span><span class="t"><span class="str">            cog.out('''</span>&nbsp;</span><span class="r"></span></p>
    <p id="t115" class="pln"><span class="n"><a href="#t115">115</a></span><span class="t"><span class="str">                This is line two</span>&nbsp;</span><span class="r"></span></p>
    <p id="t116" class="pln"><span class="n"><a href="#t116">116</a></span><span class="t"><span class="str">            ''', dedent=True, trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t117" class="pln"><span class="n"><a href="#t117">117</a></span><span class="t"><span class="str">            cog.outl("This is line three", trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t118" class="pln"><span class="n"><a href="#t118">118</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t119" class="pln"><span class="n"><a href="#t119">119</a></span><span class="t"><span class="str">            This is line one</span>&nbsp;</span><span class="r"></span></p>
    <p id="t120" class="pln"><span class="n"><a href="#t120">120</a></span><span class="t"><span class="str">            This is line two</span>&nbsp;</span><span class="r"></span></p>
    <p id="t121" class="pln"><span class="n"><a href="#t121">121</a></span><span class="t"><span class="str">            This is line three</span>&nbsp;</span><span class="r"></span></p>
    <p id="t122" class="pln"><span class="n"><a href="#t122">122</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t123" class="pln"><span class="n"><a href="#t123">123</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t124" class="pln"><span class="n"><a href="#t124">124</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t125" class="run"><span class="n"><a href="#t125">125</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t126" class="run"><span class="n"><a href="#t126">126</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t127" class="pln"><span class="n"><a href="#t127">127</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t128" class="run"><span class="n"><a href="#t128">128</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTrimEmptyBlankLines</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t129" class="run"><span class="n"><a href="#t129">129</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t130" class="pln"><span class="n"><a href="#t130">130</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t131" class="pln"><span class="n"><a href="#t131">131</a></span><span class="t"><span class="str">            cog.out("This is line one\\n", trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t132" class="pln"><span class="n"><a href="#t132">132</a></span><span class="t"><span class="str">            cog.out('''</span>&nbsp;</span><span class="r"></span></p>
    <p id="t133" class="pln"><span class="n"><a href="#t133">133</a></span><span class="t"><span class="str">                This is line two</span>&nbsp;</span><span class="r"></span></p>
    <p id="t134" class="pln"><span class="n"><a href="#t134">134</a></span><span class="t"><span class="str">            ''', dedent=True, trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t135" class="pln"><span class="n"><a href="#t135">135</a></span><span class="t"><span class="str">            cog.out('', dedent=True, trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t136" class="pln"><span class="n"><a href="#t136">136</a></span><span class="t"><span class="str">            cog.outl("This is line three", trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t137" class="pln"><span class="n"><a href="#t137">137</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t138" class="pln"><span class="n"><a href="#t138">138</a></span><span class="t"><span class="str">            This is line one</span>&nbsp;</span><span class="r"></span></p>
    <p id="t139" class="pln"><span class="n"><a href="#t139">139</a></span><span class="t"><span class="str">            This is line two</span>&nbsp;</span><span class="r"></span></p>
    <p id="t140" class="pln"><span class="n"><a href="#t140">140</a></span><span class="t"><span class="str">            This is line three</span>&nbsp;</span><span class="r"></span></p>
    <p id="t141" class="pln"><span class="n"><a href="#t141">141</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t142" class="pln"><span class="n"><a href="#t142">142</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t143" class="pln"><span class="n"><a href="#t143">143</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t144" class="run"><span class="n"><a href="#t144">144</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t145" class="run"><span class="n"><a href="#t145">145</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t146" class="pln"><span class="n"><a href="#t146">146</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t147" class="run"><span class="n"><a href="#t147">147</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTrimBlankLinesWithLastPartial</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t148" class="run"><span class="n"><a href="#t148">148</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t149" class="pln"><span class="n"><a href="#t149">149</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t150" class="pln"><span class="n"><a href="#t150">150</a></span><span class="t"><span class="str">            cog.out("This is line one\\n", trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t151" class="pln"><span class="n"><a href="#t151">151</a></span><span class="t"><span class="str">            cog.out("\\nLine two\\nLine three", trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t152" class="pln"><span class="n"><a href="#t152">152</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t153" class="pln"><span class="n"><a href="#t153">153</a></span><span class="t"><span class="str">            This is line one</span>&nbsp;</span><span class="r"></span></p>
    <p id="t154" class="pln"><span class="n"><a href="#t154">154</a></span><span class="t"><span class="str">            Line two</span>&nbsp;</span><span class="r"></span></p>
    <p id="t155" class="pln"><span class="n"><a href="#t155">155</a></span><span class="t"><span class="str">            Line three</span>&nbsp;</span><span class="r"></span></p>
    <p id="t156" class="pln"><span class="n"><a href="#t156">156</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t157" class="pln"><span class="n"><a href="#t157">157</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t158" class="pln"><span class="n"><a href="#t158">158</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t159" class="run"><span class="n"><a href="#t159">159</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t160" class="run"><span class="n"><a href="#t160">160</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t161" class="pln"><span class="n"><a href="#t161">161</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t162" class="run"><span class="n"><a href="#t162">162</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCogOutDedent</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t163" class="run"><span class="n"><a href="#t163">163</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t164" class="pln"><span class="n"><a href="#t164">164</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t165" class="pln"><span class="n"><a href="#t165">165</a></span><span class="t"><span class="str">            cog.out("This is the first line\\n")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t166" class="pln"><span class="n"><a href="#t166">166</a></span><span class="t"><span class="str">            cog.out('''</span>&nbsp;</span><span class="r"></span></p>
    <p id="t167" class="pln"><span class="n"><a href="#t167">167</a></span><span class="t"><span class="str">                This is dedent=True 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t168" class="pln"><span class="n"><a href="#t168">168</a></span><span class="t"><span class="str">                 This is dedent=True 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t169" class="pln"><span class="n"><a href="#t169">169</a></span><span class="t"><span class="str">            ''', dedent=True, trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t170" class="pln"><span class="n"><a href="#t170">170</a></span><span class="t"><span class="str">            cog.out('''</span>&nbsp;</span><span class="r"></span></p>
    <p id="t171" class="pln"><span class="n"><a href="#t171">171</a></span><span class="t"><span class="str">                This is dedent=False 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t172" class="pln"><span class="n"><a href="#t172">172</a></span><span class="t"><span class="str">                 This is dedent=False 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t173" class="pln"><span class="n"><a href="#t173">173</a></span><span class="t"><span class="str">            ''', dedent=False, trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t174" class="pln"><span class="n"><a href="#t174">174</a></span><span class="t"><span class="str">            cog.out('''</span>&nbsp;</span><span class="r"></span></p>
    <p id="t175" class="pln"><span class="n"><a href="#t175">175</a></span><span class="t"><span class="str">                This is dedent=default 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t176" class="pln"><span class="n"><a href="#t176">176</a></span><span class="t"><span class="str">                 This is dedent=default 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t177" class="pln"><span class="n"><a href="#t177">177</a></span><span class="t"><span class="str">            ''', trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t178" class="pln"><span class="n"><a href="#t178">178</a></span><span class="t"><span class="str">            cog.out("This is the last line\\n")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t179" class="pln"><span class="n"><a href="#t179">179</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t180" class="pln"><span class="n"><a href="#t180">180</a></span><span class="t"><span class="str">            This is the first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t181" class="pln"><span class="n"><a href="#t181">181</a></span><span class="t"><span class="str">            This is dedent=True 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t182" class="pln"><span class="n"><a href="#t182">182</a></span><span class="t"><span class="str">             This is dedent=True 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t183" class="pln"><span class="n"><a href="#t183">183</a></span><span class="t"><span class="str">                This is dedent=False 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t184" class="pln"><span class="n"><a href="#t184">184</a></span><span class="t"><span class="str">                 This is dedent=False 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t185" class="pln"><span class="n"><a href="#t185">185</a></span><span class="t"><span class="str">                This is dedent=default 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t186" class="pln"><span class="n"><a href="#t186">186</a></span><span class="t"><span class="str">                 This is dedent=default 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t187" class="pln"><span class="n"><a href="#t187">187</a></span><span class="t"><span class="str">            This is the last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t188" class="pln"><span class="n"><a href="#t188">188</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t189" class="pln"><span class="n"><a href="#t189">189</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t190" class="pln"><span class="n"><a href="#t190">190</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t191" class="run"><span class="n"><a href="#t191">191</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t192" class="run"><span class="n"><a href="#t192">192</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t193" class="pln"><span class="n"><a href="#t193">193</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t194" class="run"><span class="n"><a href="#t194">194</a></span><span class="t">    <span class="key">def</span> <span class="nam">test22EndOfLine</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t195" class="pln"><span class="n"><a href="#t195">195</a></span><span class="t">        <span class="com"># In Python 2.2, this cog file was not parsing because the</span>&nbsp;</span><span class="r"></span></p>
    <p id="t196" class="pln"><span class="n"><a href="#t196">196</a></span><span class="t">        <span class="com"># last line is indented but didn't end with a newline.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t197" class="run"><span class="n"><a href="#t197">197</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t198" class="pln"><span class="n"><a href="#t198">198</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t199" class="pln"><span class="n"><a href="#t199">199</a></span><span class="t"><span class="str">            import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t200" class="pln"><span class="n"><a href="#t200">200</a></span><span class="t"><span class="str">            for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t201" class="pln"><span class="n"><a href="#t201">201</a></span><span class="t"><span class="str">                cog.out("%d\\n" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t202" class="pln"><span class="n"><a href="#t202">202</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t203" class="pln"><span class="n"><a href="#t203">203</a></span><span class="t"><span class="str">            0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t204" class="pln"><span class="n"><a href="#t204">204</a></span><span class="t"><span class="str">            1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t205" class="pln"><span class="n"><a href="#t205">205</a></span><span class="t"><span class="str">            2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t206" class="pln"><span class="n"><a href="#t206">206</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t207" class="pln"><span class="n"><a href="#t207">207</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t208" class="pln"><span class="n"><a href="#t208">208</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t209" class="run"><span class="n"><a href="#t209">209</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t210" class="run"><span class="n"><a href="#t210">210</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t211" class="pln"><span class="n"><a href="#t211">211</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t212" class="run"><span class="n"><a href="#t212">212</a></span><span class="t">    <span class="key">def</span> <span class="nam">testIndentedCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t213" class="run"><span class="n"><a href="#t213">213</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t214" class="pln"><span class="n"><a href="#t214">214</a></span><span class="t"><span class="str">            first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t215" class="pln"><span class="n"><a href="#t215">215</a></span><span class="t"><span class="str">                [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t216" class="pln"><span class="n"><a href="#t216">216</a></span><span class="t"><span class="str">                import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t217" class="pln"><span class="n"><a href="#t217">217</a></span><span class="t"><span class="str">                for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t218" class="pln"><span class="n"><a href="#t218">218</a></span><span class="t"><span class="str">                    cog.out("xx%d\\n" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t219" class="pln"><span class="n"><a href="#t219">219</a></span><span class="t"><span class="str">                ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t220" class="pln"><span class="n"><a href="#t220">220</a></span><span class="t"><span class="str">                xx0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t221" class="pln"><span class="n"><a href="#t221">221</a></span><span class="t"><span class="str">                xx1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t222" class="pln"><span class="n"><a href="#t222">222</a></span><span class="t"><span class="str">                xx2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t223" class="pln"><span class="n"><a href="#t223">223</a></span><span class="t"><span class="str">                [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t224" class="pln"><span class="n"><a href="#t224">224</a></span><span class="t"><span class="str">            last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t225" class="pln"><span class="n"><a href="#t225">225</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t226" class="pln"><span class="n"><a href="#t226">226</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t227" class="run"><span class="n"><a href="#t227">227</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t228" class="run"><span class="n"><a href="#t228">228</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t229" class="pln"><span class="n"><a href="#t229">229</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t230" class="run"><span class="n"><a href="#t230">230</a></span><span class="t">    <span class="key">def</span> <span class="nam">testPrefixedCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t231" class="run"><span class="n"><a href="#t231">231</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t232" class="pln"><span class="n"><a href="#t232">232</a></span><span class="t"><span class="str">            --[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t233" class="pln"><span class="n"><a href="#t233">233</a></span><span class="t"><span class="str">            --import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t234" class="pln"><span class="n"><a href="#t234">234</a></span><span class="t"><span class="str">            --for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t235" class="pln"><span class="n"><a href="#t235">235</a></span><span class="t"><span class="str">            --    cog.out("xx%d\\n" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t236" class="pln"><span class="n"><a href="#t236">236</a></span><span class="t"><span class="str">            --]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t237" class="pln"><span class="n"><a href="#t237">237</a></span><span class="t"><span class="str">            xx0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t238" class="pln"><span class="n"><a href="#t238">238</a></span><span class="t"><span class="str">            xx1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t239" class="pln"><span class="n"><a href="#t239">239</a></span><span class="t"><span class="str">            xx2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t240" class="pln"><span class="n"><a href="#t240">240</a></span><span class="t"><span class="str">            --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t241" class="pln"><span class="n"><a href="#t241">241</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t242" class="pln"><span class="n"><a href="#t242">242</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t243" class="run"><span class="n"><a href="#t243">243</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t244" class="run"><span class="n"><a href="#t244">244</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t245" class="pln"><span class="n"><a href="#t245">245</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t246" class="run"><span class="n"><a href="#t246">246</a></span><span class="t">    <span class="key">def</span> <span class="nam">testPrefixedIndentedCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t247" class="run"><span class="n"><a href="#t247">247</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t248" class="pln"><span class="n"><a href="#t248">248</a></span><span class="t"><span class="str">            prologue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t249" class="pln"><span class="n"><a href="#t249">249</a></span><span class="t"><span class="str">            --[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t250" class="pln"><span class="n"><a href="#t250">250</a></span><span class="t"><span class="str">            --   import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t251" class="pln"><span class="n"><a href="#t251">251</a></span><span class="t"><span class="str">            --   for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t252" class="pln"><span class="n"><a href="#t252">252</a></span><span class="t"><span class="str">            --       cog.out("xy%d\\n" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t253" class="pln"><span class="n"><a href="#t253">253</a></span><span class="t"><span class="str">            --]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t254" class="pln"><span class="n"><a href="#t254">254</a></span><span class="t"><span class="str">            xy0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t255" class="pln"><span class="n"><a href="#t255">255</a></span><span class="t"><span class="str">            xy1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t256" class="pln"><span class="n"><a href="#t256">256</a></span><span class="t"><span class="str">            xy2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t257" class="pln"><span class="n"><a href="#t257">257</a></span><span class="t"><span class="str">            --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t258" class="pln"><span class="n"><a href="#t258">258</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t259" class="pln"><span class="n"><a href="#t259">259</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t260" class="run"><span class="n"><a href="#t260">260</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t261" class="run"><span class="n"><a href="#t261">261</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t262" class="pln"><span class="n"><a href="#t262">262</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t263" class="run"><span class="n"><a href="#t263">263</a></span><span class="t">    <span class="key">def</span> <span class="nam">testBogusPrefixMatch</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t264" class="run"><span class="n"><a href="#t264">264</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t265" class="pln"><span class="n"><a href="#t265">265</a></span><span class="t"><span class="str">            prologue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t266" class="pln"><span class="n"><a href="#t266">266</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t267" class="pln"><span class="n"><a href="#t267">267</a></span><span class="t"><span class="str">                import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t268" class="pln"><span class="n"><a href="#t268">268</a></span><span class="t"><span class="str">                # This comment should not be clobbered by removing the pound sign.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t269" class="pln"><span class="n"><a href="#t269">269</a></span><span class="t"><span class="str">                for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t270" class="pln"><span class="n"><a href="#t270">270</a></span><span class="t"><span class="str">                    cog.out("xy%d\\n" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t271" class="pln"><span class="n"><a href="#t271">271</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t272" class="pln"><span class="n"><a href="#t272">272</a></span><span class="t"><span class="str">            xy0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t273" class="pln"><span class="n"><a href="#t273">273</a></span><span class="t"><span class="str">            xy1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t274" class="pln"><span class="n"><a href="#t274">274</a></span><span class="t"><span class="str">            xy2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t275" class="pln"><span class="n"><a href="#t275">275</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t276" class="pln"><span class="n"><a href="#t276">276</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t277" class="pln"><span class="n"><a href="#t277">277</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t278" class="run"><span class="n"><a href="#t278">278</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t279" class="run"><span class="n"><a href="#t279">279</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t280" class="pln"><span class="n"><a href="#t280">280</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t281" class="run"><span class="n"><a href="#t281">281</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoFinalNewline</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t282" class="pln"><span class="n"><a href="#t282">282</a></span><span class="t">        <span class="com"># If the cog'ed output has no final newline,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t283" class="pln"><span class="n"><a href="#t283">283</a></span><span class="t">        <span class="com"># it shouldn't eat up the cog terminator.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t284" class="run"><span class="n"><a href="#t284">284</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t285" class="pln"><span class="n"><a href="#t285">285</a></span><span class="t"><span class="str">            prologue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t286" class="pln"><span class="n"><a href="#t286">286</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t287" class="pln"><span class="n"><a href="#t287">287</a></span><span class="t"><span class="str">                import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t288" class="pln"><span class="n"><a href="#t288">288</a></span><span class="t"><span class="str">                for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t289" class="pln"><span class="n"><a href="#t289">289</a></span><span class="t"><span class="str">                    cog.out("%d" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t290" class="pln"><span class="n"><a href="#t290">290</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t291" class="pln"><span class="n"><a href="#t291">291</a></span><span class="t"><span class="str">            012</span>&nbsp;</span><span class="r"></span></p>
    <p id="t292" class="pln"><span class="n"><a href="#t292">292</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t293" class="pln"><span class="n"><a href="#t293">293</a></span><span class="t"><span class="str">            epilogue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t294" class="pln"><span class="n"><a href="#t294">294</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t295" class="pln"><span class="n"><a href="#t295">295</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t296" class="run"><span class="n"><a href="#t296">296</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t297" class="run"><span class="n"><a href="#t297">297</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t298" class="pln"><span class="n"><a href="#t298">298</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t299" class="run"><span class="n"><a href="#t299">299</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoOutputAtAll</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t300" class="pln"><span class="n"><a href="#t300">300</a></span><span class="t">        <span class="com"># If there is absolutely no cog output, that's ok.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t301" class="run"><span class="n"><a href="#t301">301</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t302" class="pln"><span class="n"><a href="#t302">302</a></span><span class="t"><span class="str">            prologue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t303" class="pln"><span class="n"><a href="#t303">303</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t304" class="pln"><span class="n"><a href="#t304">304</a></span><span class="t"><span class="str">                i = 1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t305" class="pln"><span class="n"><a href="#t305">305</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t306" class="pln"><span class="n"><a href="#t306">306</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t307" class="pln"><span class="n"><a href="#t307">307</a></span><span class="t"><span class="str">            epilogue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t308" class="pln"><span class="n"><a href="#t308">308</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t309" class="pln"><span class="n"><a href="#t309">309</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t310" class="run"><span class="n"><a href="#t310">310</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t311" class="run"><span class="n"><a href="#t311">311</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t312" class="pln"><span class="n"><a href="#t312">312</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t313" class="run"><span class="n"><a href="#t313">313</a></span><span class="t">    <span class="key">def</span> <span class="nam">testPurelyBlankLine</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t314" class="pln"><span class="n"><a href="#t314">314</a></span><span class="t">        <span class="com"># If there is a blank line in the cog code with no whitespace</span>&nbsp;</span><span class="r"></span></p>
    <p id="t315" class="pln"><span class="n"><a href="#t315">315</a></span><span class="t">        <span class="com"># prefix, that should be OK.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t316" class="pln"><span class="n"><a href="#t316">316</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t317" class="run"><span class="n"><a href="#t317">317</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t318" class="pln"><span class="n"><a href="#t318">318</a></span><span class="t"><span class="str">            prologue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t319" class="pln"><span class="n"><a href="#t319">319</a></span><span class="t"><span class="str">                [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t320" class="pln"><span class="n"><a href="#t320">320</a></span><span class="t"><span class="str">                    import sys</span>&nbsp;</span><span class="r"></span></p>
    <p id="t321" class="pln"><span class="n"><a href="#t321">321</a></span><span class="t"><span class="str">                    cog.out("Hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t322" class="pln"><span class="n"><a href="#t322">322</a></span><span class="t"><span class="str">            $</span>&nbsp;</span><span class="r"></span></p>
    <p id="t323" class="pln"><span class="n"><a href="#t323">323</a></span><span class="t"><span class="str">                    cog.out("There")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t324" class="pln"><span class="n"><a href="#t324">324</a></span><span class="t"><span class="str">                ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t325" class="pln"><span class="n"><a href="#t325">325</a></span><span class="t"><span class="str">                HelloThere</span>&nbsp;</span><span class="r"></span></p>
    <p id="t326" class="pln"><span class="n"><a href="#t326">326</a></span><span class="t"><span class="str">                [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t327" class="pln"><span class="n"><a href="#t327">327</a></span><span class="t"><span class="str">            epilogue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t328" class="pln"><span class="n"><a href="#t328">328</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t329" class="pln"><span class="n"><a href="#t329">329</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t330" class="run"><span class="n"><a href="#t330">330</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'$'</span><span class="op">,</span> <span class="str">''</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t331" class="run"><span class="n"><a href="#t331">331</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t332" class="pln"><span class="n"><a href="#t332">332</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t333" class="run"><span class="n"><a href="#t333">333</a></span><span class="t">    <span class="key">def</span> <span class="nam">testEmptyOutl</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t334" class="pln"><span class="n"><a href="#t334">334</a></span><span class="t">        <span class="com"># Alexander Belchenko suggested the string argument to outl should</span>&nbsp;</span><span class="r"></span></p>
    <p id="t335" class="pln"><span class="n"><a href="#t335">335</a></span><span class="t">        <span class="com"># be optional.  Does it work?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t336" class="pln"><span class="n"><a href="#t336">336</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t337" class="run"><span class="n"><a href="#t337">337</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t338" class="pln"><span class="n"><a href="#t338">338</a></span><span class="t"><span class="str">            prologue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t339" class="pln"><span class="n"><a href="#t339">339</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t340" class="pln"><span class="n"><a href="#t340">340</a></span><span class="t"><span class="str">                cog.outl("x")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t341" class="pln"><span class="n"><a href="#t341">341</a></span><span class="t"><span class="str">                cog.outl()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t342" class="pln"><span class="n"><a href="#t342">342</a></span><span class="t"><span class="str">                cog.outl("y")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t343" class="pln"><span class="n"><a href="#t343">343</a></span><span class="t"><span class="str">                cog.out()   # Also optional, a complete no-op.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t344" class="pln"><span class="n"><a href="#t344">344</a></span><span class="t"><span class="str">                cog.outl(trimblanklines=True)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t345" class="pln"><span class="n"><a href="#t345">345</a></span><span class="t"><span class="str">                cog.outl("z")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t346" class="pln"><span class="n"><a href="#t346">346</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t347" class="pln"><span class="n"><a href="#t347">347</a></span><span class="t"><span class="str">            x</span>&nbsp;</span><span class="r"></span></p>
    <p id="t348" class="pln"><span class="n"><a href="#t348">348</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t349" class="pln"><span class="n"><a href="#t349">349</a></span><span class="t"><span class="str">            y</span>&nbsp;</span><span class="r"></span></p>
    <p id="t350" class="pln"><span class="n"><a href="#t350">350</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t351" class="pln"><span class="n"><a href="#t351">351</a></span><span class="t"><span class="str">            z</span>&nbsp;</span><span class="r"></span></p>
    <p id="t352" class="pln"><span class="n"><a href="#t352">352</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t353" class="pln"><span class="n"><a href="#t353">353</a></span><span class="t"><span class="str">            epilogue</span>&nbsp;</span><span class="r"></span></p>
    <p id="t354" class="pln"><span class="n"><a href="#t354">354</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t355" class="pln"><span class="n"><a href="#t355">355</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t356" class="run"><span class="n"><a href="#t356">356</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t357" class="run"><span class="n"><a href="#t357">357</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t358" class="pln"><span class="n"><a href="#t358">358</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t359" class="run"><span class="n"><a href="#t359">359</a></span><span class="t">    <span class="key">def</span> <span class="nam">testFirstLineNum</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t360" class="run"><span class="n"><a href="#t360">360</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t361" class="pln"><span class="n"><a href="#t361">361</a></span><span class="t"><span class="str">            fooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t362" class="pln"><span class="n"><a href="#t362">362</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t363" class="pln"><span class="n"><a href="#t363">363</a></span><span class="t"><span class="str">                cog.outl("started at line number %d" % cog.firstLineNum)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t364" class="pln"><span class="n"><a href="#t364">364</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t365" class="pln"><span class="n"><a href="#t365">365</a></span><span class="t"><span class="str">            started at line number 2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t366" class="pln"><span class="n"><a href="#t366">366</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t367" class="pln"><span class="n"><a href="#t367">367</a></span><span class="t"><span class="str">            blah blah</span>&nbsp;</span><span class="r"></span></p>
    <p id="t368" class="pln"><span class="n"><a href="#t368">368</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t369" class="pln"><span class="n"><a href="#t369">369</a></span><span class="t"><span class="str">                cog.outl("and again at line %d" % cog.firstLineNum)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t370" class="pln"><span class="n"><a href="#t370">370</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t371" class="pln"><span class="n"><a href="#t371">371</a></span><span class="t"><span class="str">            and again at line 8</span>&nbsp;</span><span class="r"></span></p>
    <p id="t372" class="pln"><span class="n"><a href="#t372">372</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t373" class="pln"><span class="n"><a href="#t373">373</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t374" class="pln"><span class="n"><a href="#t374">374</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t375" class="run"><span class="n"><a href="#t375">375</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t376" class="run"><span class="n"><a href="#t376">376</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t377" class="pln"><span class="n"><a href="#t377">377</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t378" class="run"><span class="n"><a href="#t378">378</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCompactOneLineCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t379" class="run"><span class="n"><a href="#t379">379</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t380" class="pln"><span class="n"><a href="#t380">380</a></span><span class="t"><span class="str">            first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t381" class="pln"><span class="n"><a href="#t381">381</a></span><span class="t"><span class="str">            hey: [[[cog cog.outl("hello %d" % (3*3*3*3)) ]]] looky!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t382" class="pln"><span class="n"><a href="#t382">382</a></span><span class="t"><span class="str">            get rid of this!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t383" class="pln"><span class="n"><a href="#t383">383</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t384" class="pln"><span class="n"><a href="#t384">384</a></span><span class="t"><span class="str">            last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t385" class="pln"><span class="n"><a href="#t385">385</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t386" class="pln"><span class="n"><a href="#t386">386</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t387" class="run"><span class="n"><a href="#t387">387</a></span><span class="t">        <span class="nam">outfile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t388" class="pln"><span class="n"><a href="#t388">388</a></span><span class="t"><span class="str">            first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t389" class="pln"><span class="n"><a href="#t389">389</a></span><span class="t"><span class="str">            hey: [[[cog cog.outl("hello %d" % (3*3*3*3)) ]]] looky!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t390" class="pln"><span class="n"><a href="#t390">390</a></span><span class="t"><span class="str">            hello 81</span>&nbsp;</span><span class="r"></span></p>
    <p id="t391" class="pln"><span class="n"><a href="#t391">391</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t392" class="pln"><span class="n"><a href="#t392">392</a></span><span class="t"><span class="str">            last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t393" class="pln"><span class="n"><a href="#t393">393</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t394" class="pln"><span class="n"><a href="#t394">394</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t395" class="run"><span class="n"><a href="#t395">395</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t396" class="run"><span class="n"><a href="#t396">396</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">outfile</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t397" class="pln"><span class="n"><a href="#t397">397</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t398" class="run"><span class="n"><a href="#t398">398</a></span><span class="t">    <span class="key">def</span> <span class="nam">testInsideOutCompact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t399" class="run"><span class="n"><a href="#t399">399</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t400" class="pln"><span class="n"><a href="#t400">400</a></span><span class="t"><span class="str">            first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t401" class="pln"><span class="n"><a href="#t401">401</a></span><span class="t"><span class="str">            hey?: ]]] what is this? [[[cog strange!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t402" class="pln"><span class="n"><a href="#t402">402</a></span><span class="t"><span class="str">            get rid of this!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t403" class="pln"><span class="n"><a href="#t403">403</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t404" class="pln"><span class="n"><a href="#t404">404</a></span><span class="t"><span class="str">            last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t405" class="pln"><span class="n"><a href="#t405">405</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t406" class="run"><span class="n"><a href="#t406">406</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">r"^infile.txt\(2\): Cog code markers inverted$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t407" class="run"><span class="n"><a href="#t407">407</a></span><span class="t">             <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="str">"infile.txt"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t408" class="pln"><span class="n"><a href="#t408">408</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t409" class="run"><span class="n"><a href="#t409">409</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSharingGlobals</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t410" class="run"><span class="n"><a href="#t410">410</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t411" class="pln"><span class="n"><a href="#t411">411</a></span><span class="t"><span class="str">            first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t412" class="pln"><span class="n"><a href="#t412">412</a></span><span class="t"><span class="str">            hey: [[[cog s="hey there" ]]] looky!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t413" class="pln"><span class="n"><a href="#t413">413</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t414" class="pln"><span class="n"><a href="#t414">414</a></span><span class="t"><span class="str">            more literal junk.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t415" class="pln"><span class="n"><a href="#t415">415</a></span><span class="t"><span class="str">            [[[cog cog.outl(s) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t416" class="pln"><span class="n"><a href="#t416">416</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t417" class="pln"><span class="n"><a href="#t417">417</a></span><span class="t"><span class="str">            last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t418" class="pln"><span class="n"><a href="#t418">418</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t419" class="pln"><span class="n"><a href="#t419">419</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t420" class="run"><span class="n"><a href="#t420">420</a></span><span class="t">        <span class="nam">outfile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t421" class="pln"><span class="n"><a href="#t421">421</a></span><span class="t"><span class="str">            first line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t422" class="pln"><span class="n"><a href="#t422">422</a></span><span class="t"><span class="str">            hey: [[[cog s="hey there" ]]] looky!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t423" class="pln"><span class="n"><a href="#t423">423</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t424" class="pln"><span class="n"><a href="#t424">424</a></span><span class="t"><span class="str">            more literal junk.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t425" class="pln"><span class="n"><a href="#t425">425</a></span><span class="t"><span class="str">            [[[cog cog.outl(s) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t426" class="pln"><span class="n"><a href="#t426">426</a></span><span class="t"><span class="str">            hey there</span>&nbsp;</span><span class="r"></span></p>
    <p id="t427" class="pln"><span class="n"><a href="#t427">427</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t428" class="pln"><span class="n"><a href="#t428">428</a></span><span class="t"><span class="str">            last line</span>&nbsp;</span><span class="r"></span></p>
    <p id="t429" class="pln"><span class="n"><a href="#t429">429</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t430" class="pln"><span class="n"><a href="#t430">430</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t431" class="run"><span class="n"><a href="#t431">431</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t432" class="run"><span class="n"><a href="#t432">432</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">outfile</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t433" class="pln"><span class="n"><a href="#t433">433</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t434" class="run"><span class="n"><a href="#t434">434</a></span><span class="t">    <span class="key">def</span> <span class="nam">testAssertInCogCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t435" class="pln"><span class="n"><a href="#t435">435</a></span><span class="t">        <span class="com"># Check that we can test assertions in cog code in the test framework.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t436" class="run"><span class="n"><a href="#t436">436</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t437" class="pln"><span class="n"><a href="#t437">437</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t438" class="pln"><span class="n"><a href="#t438">438</a></span><span class="t"><span class="str">            assert 1 == 2, "Oops"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t439" class="pln"><span class="n"><a href="#t439">439</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t440" class="pln"><span class="n"><a href="#t440">440</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t441" class="pln"><span class="n"><a href="#t441">441</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t442" class="run"><span class="n"><a href="#t442">442</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t443" class="run"><span class="n"><a href="#t443">443</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUserException</span><span class="op">,</span> <span class="str">"AssertionError: Oops"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t444" class="run"><span class="n"><a href="#t444">444</a></span><span class="t">            <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t445" class="pln"><span class="n"><a href="#t445">445</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t446" class="run"><span class="n"><a href="#t446">446</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCogPrevious</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t447" class="pln"><span class="n"><a href="#t447">447</a></span><span class="t">        <span class="com"># Check that we can access the previous run's output.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t448" class="run"><span class="n"><a href="#t448">448</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t449" class="pln"><span class="n"><a href="#t449">449</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t450" class="pln"><span class="n"><a href="#t450">450</a></span><span class="t"><span class="str">            assert cog.previous == "Hello there!\\n", "WTF??"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t451" class="pln"><span class="n"><a href="#t451">451</a></span><span class="t"><span class="str">            cog.out(cog.previous)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t452" class="pln"><span class="n"><a href="#t452">452</a></span><span class="t"><span class="str">            cog.outl("Ran again!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t453" class="pln"><span class="n"><a href="#t453">453</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t454" class="pln"><span class="n"><a href="#t454">454</a></span><span class="t"><span class="str">            Hello there!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t455" class="pln"><span class="n"><a href="#t455">455</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t456" class="pln"><span class="n"><a href="#t456">456</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t457" class="pln"><span class="n"><a href="#t457">457</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t458" class="run"><span class="n"><a href="#t458">458</a></span><span class="t">        <span class="nam">outfile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t459" class="pln"><span class="n"><a href="#t459">459</a></span><span class="t"><span class="str">            [[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t460" class="pln"><span class="n"><a href="#t460">460</a></span><span class="t"><span class="str">            assert cog.previous == "Hello there!\\n", "WTF??"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t461" class="pln"><span class="n"><a href="#t461">461</a></span><span class="t"><span class="str">            cog.out(cog.previous)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t462" class="pln"><span class="n"><a href="#t462">462</a></span><span class="t"><span class="str">            cog.outl("Ran again!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t463" class="pln"><span class="n"><a href="#t463">463</a></span><span class="t"><span class="str">            ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t464" class="pln"><span class="n"><a href="#t464">464</a></span><span class="t"><span class="str">            Hello there!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t465" class="pln"><span class="n"><a href="#t465">465</a></span><span class="t"><span class="str">            Ran again!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t466" class="pln"><span class="n"><a href="#t466">466</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t467" class="pln"><span class="n"><a href="#t467">467</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t468" class="pln"><span class="n"><a href="#t468">468</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t469" class="run"><span class="n"><a href="#t469">469</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t470" class="run"><span class="n"><a href="#t470">470</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">outfile</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t471" class="pln"><span class="n"><a href="#t471">471</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t472" class="pln"><span class="n"><a href="#t472">472</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t473" class="run"><span class="n"><a href="#t473">473</a></span><span class="t"><span class="key">class</span> <span class="nam">CogOptionsTests</span><span class="op">(</span><span class="nam">TestCase</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t474" class="pln"><span class="n"><a href="#t474">474</a></span><span class="t">    <span class="str">""" Test the CogOptions class.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t475" class="pln"><span class="n"><a href="#t475">475</a></span><span class="t"><span class="str">    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t476" class="pln"><span class="n"><a href="#t476">476</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t477" class="run"><span class="n"><a href="#t477">477</a></span><span class="t">    <span class="key">def</span> <span class="nam">testEquality</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t478" class="mis show_mis"><span class="n"><a href="#t478">478</a></span><span class="t">        <span class="nam">o</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t479" class="mis show_mis"><span class="n"><a href="#t479">479</a></span><span class="t">        <span class="nam">p</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t480" class="mis show_mis"><span class="n"><a href="#t480">480</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">o</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t481" class="mis show_mis"><span class="n"><a href="#t481">481</a></span><span class="t">        <span class="nam">o</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-r'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t482" class="mis show_mis"><span class="n"><a href="#t482">482</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertNotEqual</span><span class="op">(</span><span class="nam">o</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t483" class="mis show_mis"><span class="n"><a href="#t483">483</a></span><span class="t">        <span class="nam">p</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-r'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t484" class="mis show_mis"><span class="n"><a href="#t484">484</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">o</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t485" class="pln"><span class="n"><a href="#t485">485</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t486" class="run"><span class="n"><a href="#t486">486</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCloning</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t487" class="mis show_mis"><span class="n"><a href="#t487">487</a></span><span class="t">        <span class="nam">o</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t488" class="mis show_mis"><span class="n"><a href="#t488">488</a></span><span class="t">        <span class="nam">o</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-I'</span><span class="op">,</span> <span class="str">'fooey'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'booey'</span><span class="op">,</span> <span class="str">'-s'</span><span class="op">,</span> <span class="str">' /*x*/'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t489" class="mis show_mis"><span class="n"><a href="#t489">489</a></span><span class="t">        <span class="nam">p</span> <span class="op">=</span> <span class="nam">o</span><span class="op">.</span><span class="nam">clone</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t490" class="mis show_mis"><span class="n"><a href="#t490">490</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">o</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t491" class="mis show_mis"><span class="n"><a href="#t491">491</a></span><span class="t">        <span class="nam">p</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-I'</span><span class="op">,</span> <span class="str">'huey'</span><span class="op">,</span> <span class="str">'-D'</span><span class="op">,</span> <span class="str">'foo=quux'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t492" class="mis show_mis"><span class="n"><a href="#t492">492</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertNotEqual</span><span class="op">(</span><span class="nam">o</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t493" class="mis show_mis"><span class="n"><a href="#t493">493</a></span><span class="t">        <span class="nam">q</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t494" class="mis show_mis"><span class="n"><a href="#t494">494</a></span><span class="t">        <span class="nam">q</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-I'</span><span class="op">,</span> <span class="str">'fooey'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'booey'</span><span class="op">,</span> <span class="str">'-s'</span><span class="op">,</span> <span class="str">' /*x*/'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'huey'</span><span class="op">,</span> <span class="str">'-D'</span><span class="op">,</span> <span class="str">'foo=quux'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t495" class="mis show_mis"><span class="n"><a href="#t495">495</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">q</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t496" class="pln"><span class="n"><a href="#t496">496</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t497" class="run"><span class="n"><a href="#t497">497</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCombiningFlags</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t498" class="pln"><span class="n"><a href="#t498">498</a></span><span class="t">        <span class="com"># Single-character flags can be combined.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t499" class="mis show_mis"><span class="n"><a href="#t499">499</a></span><span class="t">        <span class="nam">o</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t500" class="mis show_mis"><span class="n"><a href="#t500">500</a></span><span class="t">        <span class="nam">o</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-e'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-z'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t501" class="mis show_mis"><span class="n"><a href="#t501">501</a></span><span class="t">        <span class="nam">p</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t502" class="mis show_mis"><span class="n"><a href="#t502">502</a></span><span class="t">        <span class="nam">p</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'-erz'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t503" class="mis show_mis"><span class="n"><a href="#t503">503</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">o</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t504" class="pln"><span class="n"><a href="#t504">504</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t505" class="run"><span class="n"><a href="#t505">505</a></span><span class="t">    <span class="key">def</span> <span class="nam">testMarkers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t506" class="mis show_mis"><span class="n"><a href="#t506">506</a></span><span class="t">        <span class="nam">o</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t507" class="mis show_mis"><span class="n"><a href="#t507">507</a></span><span class="t">        <span class="nam">o</span><span class="op">.</span><span class="nam">_parse_markers</span><span class="op">(</span><span class="str">'a b c'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t508" class="mis show_mis"><span class="n"><a href="#t508">508</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'a'</span><span class="op">,</span> <span class="nam">o</span><span class="op">.</span><span class="nam">sBeginSpec</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t509" class="mis show_mis"><span class="n"><a href="#t509">509</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'b'</span><span class="op">,</span> <span class="nam">o</span><span class="op">.</span><span class="nam">sEndSpec</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t510" class="mis show_mis"><span class="n"><a href="#t510">510</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'c'</span><span class="op">,</span> <span class="nam">o</span><span class="op">.</span><span class="nam">sEndOutput</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t511" class="pln"><span class="n"><a href="#t511">511</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t512" class="run"><span class="n"><a href="#t512">512</a></span><span class="t">    <span class="key">def</span> <span class="nam">testMarkersSwitch</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t513" class="mis show_mis"><span class="n"><a href="#t513">513</a></span><span class="t">        <span class="nam">o</span> <span class="op">=</span> <span class="nam">CogOptions</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t514" class="mis show_mis"><span class="n"><a href="#t514">514</a></span><span class="t">        <span class="nam">o</span><span class="op">.</span><span class="nam">parseArgs</span><span class="op">(</span><span class="op">[</span><span class="str">'--markers'</span><span class="op">,</span> <span class="str">'a b c'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t515" class="mis show_mis"><span class="n"><a href="#t515">515</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'a'</span><span class="op">,</span> <span class="nam">o</span><span class="op">.</span><span class="nam">sBeginSpec</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t516" class="mis show_mis"><span class="n"><a href="#t516">516</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'b'</span><span class="op">,</span> <span class="nam">o</span><span class="op">.</span><span class="nam">sEndSpec</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t517" class="mis show_mis"><span class="n"><a href="#t517">517</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'c'</span><span class="op">,</span> <span class="nam">o</span><span class="op">.</span><span class="nam">sEndOutput</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t518" class="pln"><span class="n"><a href="#t518">518</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t519" class="pln"><span class="n"><a href="#t519">519</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t520" class="run"><span class="n"><a href="#t520">520</a></span><span class="t"><span class="key">class</span> <span class="nam">FileStructureTests</span><span class="op">(</span><span class="nam">TestCase</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t521" class="pln"><span class="n"><a href="#t521">521</a></span><span class="t">    <span class="str">""" Test cases to check that we're properly strict about the structure</span>&nbsp;</span><span class="r"></span></p>
    <p id="t522" class="pln"><span class="n"><a href="#t522">522</a></span><span class="t"><span class="str">        of files.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t523" class="pln"><span class="n"><a href="#t523">523</a></span><span class="t"><span class="str">    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t524" class="pln"><span class="n"><a href="#t524">524</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t525" class="run"><span class="n"><a href="#t525">525</a></span><span class="t">    <span class="key">def</span> <span class="nam">isBad</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">infile</span><span class="op">,</span> <span class="nam">msg</span><span class="op">=</span><span class="key">None</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t526" class="mis show_mis"><span class="n"><a href="#t526">526</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t527" class="mis show_mis"><span class="n"><a href="#t527">527</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">"^"</span><span class="op">+</span><span class="nam">re</span><span class="op">.</span><span class="nam">escape</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span><span class="op">+</span><span class="str">"$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t528" class="mis show_mis"><span class="n"><a href="#t528">528</a></span><span class="t">            <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">'infile.txt'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t529" class="pln"><span class="n"><a href="#t529">529</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t530" class="run"><span class="n"><a href="#t530">530</a></span><span class="t">    <span class="key">def</span> <span class="nam">testBeginNoEnd</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t531" class="mis show_mis"><span class="n"><a href="#t531">531</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t532" class="pln"><span class="n"><a href="#t532">532</a></span><span class="t"><span class="str">            Fooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t533" class="pln"><span class="n"><a href="#t533">533</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t534" class="pln"><span class="n"><a href="#t534">534</a></span><span class="t"><span class="str">                cog.outl('hello')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t535" class="pln"><span class="n"><a href="#t535">535</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t536" class="mis show_mis"><span class="n"><a href="#t536">536</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(2): Cog block begun but never ended."</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t537" class="pln"><span class="n"><a href="#t537">537</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t538" class="run"><span class="n"><a href="#t538">538</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoEoo</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t539" class="mis show_mis"><span class="n"><a href="#t539">539</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t540" class="pln"><span class="n"><a href="#t540">540</a></span><span class="t"><span class="str">            Fooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t541" class="pln"><span class="n"><a href="#t541">541</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t542" class="pln"><span class="n"><a href="#t542">542</a></span><span class="t"><span class="str">                cog.outl('hello')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t543" class="pln"><span class="n"><a href="#t543">543</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t544" class="pln"><span class="n"><a href="#t544">544</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t545" class="mis show_mis"><span class="n"><a href="#t545">545</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(4): Missing '[[[end]]]' before end of file."</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t546" class="pln"><span class="n"><a href="#t546">546</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t547" class="mis show_mis"><span class="n"><a href="#t547">547</a></span><span class="t">        <span class="nam">infile2</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t548" class="pln"><span class="n"><a href="#t548">548</a></span><span class="t"><span class="str">            Fooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t549" class="pln"><span class="n"><a href="#t549">549</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t550" class="pln"><span class="n"><a href="#t550">550</a></span><span class="t"><span class="str">                cog.outl('hello')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t551" class="pln"><span class="n"><a href="#t551">551</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t552" class="pln"><span class="n"><a href="#t552">552</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t553" class="pln"><span class="n"><a href="#t553">553</a></span><span class="t"><span class="str">                cog.outl('goodbye')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t554" class="pln"><span class="n"><a href="#t554">554</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t555" class="pln"><span class="n"><a href="#t555">555</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t556" class="mis show_mis"><span class="n"><a href="#t556">556</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile2</span><span class="op">,</span> <span class="str">"infile.txt(5): Unexpected '[[[cog'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t557" class="pln"><span class="n"><a href="#t557">557</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t558" class="run"><span class="n"><a href="#t558">558</a></span><span class="t">    <span class="key">def</span> <span class="nam">testStartWithEnd</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t559" class="mis show_mis"><span class="n"><a href="#t559">559</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t560" class="pln"><span class="n"><a href="#t560">560</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t561" class="pln"><span class="n"><a href="#t561">561</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t562" class="mis show_mis"><span class="n"><a href="#t562">562</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(1): Unexpected ']]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t563" class="pln"><span class="n"><a href="#t563">563</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t564" class="mis show_mis"><span class="n"><a href="#t564">564</a></span><span class="t">        <span class="nam">infile2</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t565" class="pln"><span class="n"><a href="#t565">565</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t566" class="pln"><span class="n"><a href="#t566">566</a></span><span class="t"><span class="str">                cog.outl('hello')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t567" class="pln"><span class="n"><a href="#t567">567</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t568" class="pln"><span class="n"><a href="#t568">568</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t569" class="pln"><span class="n"><a href="#t569">569</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t570" class="pln"><span class="n"><a href="#t570">570</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t571" class="mis show_mis"><span class="n"><a href="#t571">571</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile2</span><span class="op">,</span> <span class="str">"infile.txt(5): Unexpected ']]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t572" class="pln"><span class="n"><a href="#t572">572</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t573" class="run"><span class="n"><a href="#t573">573</a></span><span class="t">    <span class="key">def</span> <span class="nam">testStartWithEoo</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t574" class="mis show_mis"><span class="n"><a href="#t574">574</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t575" class="pln"><span class="n"><a href="#t575">575</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t576" class="pln"><span class="n"><a href="#t576">576</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t577" class="mis show_mis"><span class="n"><a href="#t577">577</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(1): Unexpected '[[[end]]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t578" class="pln"><span class="n"><a href="#t578">578</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t579" class="mis show_mis"><span class="n"><a href="#t579">579</a></span><span class="t">        <span class="nam">infile2</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t580" class="pln"><span class="n"><a href="#t580">580</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t581" class="pln"><span class="n"><a href="#t581">581</a></span><span class="t"><span class="str">                cog.outl('hello')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t582" class="pln"><span class="n"><a href="#t582">582</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t583" class="pln"><span class="n"><a href="#t583">583</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t584" class="pln"><span class="n"><a href="#t584">584</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t585" class="pln"><span class="n"><a href="#t585">585</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t586" class="mis show_mis"><span class="n"><a href="#t586">586</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile2</span><span class="op">,</span> <span class="str">"infile.txt(5): Unexpected '[[[end]]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t587" class="pln"><span class="n"><a href="#t587">587</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t588" class="run"><span class="n"><a href="#t588">588</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoEnd</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t589" class="mis show_mis"><span class="n"><a href="#t589">589</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t590" class="pln"><span class="n"><a href="#t590">590</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t591" class="pln"><span class="n"><a href="#t591">591</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t592" class="pln"><span class="n"><a href="#t592">592</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t593" class="pln"><span class="n"><a href="#t593">593</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t594" class="mis show_mis"><span class="n"><a href="#t594">594</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(3): Unexpected '[[[end]]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t595" class="pln"><span class="n"><a href="#t595">595</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t596" class="mis show_mis"><span class="n"><a href="#t596">596</a></span><span class="t">        <span class="nam">infile2</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t597" class="pln"><span class="n"><a href="#t597">597</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t598" class="pln"><span class="n"><a href="#t598">598</a></span><span class="t"><span class="str">                cog.outl('hello')</span>&nbsp;</span><span class="r"></span></p>
    <p id="t599" class="pln"><span class="n"><a href="#t599">599</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t600" class="pln"><span class="n"><a href="#t600">600</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t601" class="pln"><span class="n"><a href="#t601">601</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t602" class="pln"><span class="n"><a href="#t602">602</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t603" class="pln"><span class="n"><a href="#t603">603</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t604" class="pln"><span class="n"><a href="#t604">604</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t605" class="mis show_mis"><span class="n"><a href="#t605">605</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile2</span><span class="op">,</span> <span class="str">"infile.txt(7): Unexpected '[[[end]]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t606" class="pln"><span class="n"><a href="#t606">606</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t607" class="run"><span class="n"><a href="#t607">607</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTwoBegins</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t608" class="mis show_mis"><span class="n"><a href="#t608">608</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t609" class="pln"><span class="n"><a href="#t609">609</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t610" class="pln"><span class="n"><a href="#t610">610</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t611" class="pln"><span class="n"><a href="#t611">611</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t612" class="pln"><span class="n"><a href="#t612">612</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t613" class="pln"><span class="n"><a href="#t613">613</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t614" class="pln"><span class="n"><a href="#t614">614</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t615" class="mis show_mis"><span class="n"><a href="#t615">615</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(2): Unexpected '[[[cog'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t616" class="pln"><span class="n"><a href="#t616">616</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t617" class="mis show_mis"><span class="n"><a href="#t617">617</a></span><span class="t">        <span class="nam">infile2</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t618" class="pln"><span class="n"><a href="#t618">618</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t619" class="pln"><span class="n"><a href="#t619">619</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t620" class="pln"><span class="n"><a href="#t620">620</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t621" class="pln"><span class="n"><a href="#t621">621</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t622" class="pln"><span class="n"><a href="#t622">622</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t623" class="pln"><span class="n"><a href="#t623">623</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t624" class="pln"><span class="n"><a href="#t624">624</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t625" class="pln"><span class="n"><a href="#t625">625</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t626" class="pln"><span class="n"><a href="#t626">626</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t627" class="pln"><span class="n"><a href="#t627">627</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t628" class="mis show_mis"><span class="n"><a href="#t628">628</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile2</span><span class="op">,</span> <span class="str">"infile.txt(6): Unexpected '[[[cog'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t629" class="pln"><span class="n"><a href="#t629">629</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t630" class="run"><span class="n"><a href="#t630">630</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTwoEnds</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t631" class="mis show_mis"><span class="n"><a href="#t631">631</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t632" class="pln"><span class="n"><a href="#t632">632</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t633" class="pln"><span class="n"><a href="#t633">633</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t634" class="pln"><span class="n"><a href="#t634">634</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t635" class="pln"><span class="n"><a href="#t635">635</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t636" class="pln"><span class="n"><a href="#t636">636</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t637" class="pln"><span class="n"><a href="#t637">637</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t638" class="mis show_mis"><span class="n"><a href="#t638">638</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile</span><span class="op">,</span> <span class="str">"infile.txt(4): Unexpected ']]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t639" class="pln"><span class="n"><a href="#t639">639</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t640" class="mis show_mis"><span class="n"><a href="#t640">640</a></span><span class="t">        <span class="nam">infile2</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t641" class="pln"><span class="n"><a href="#t641">641</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t642" class="pln"><span class="n"><a href="#t642">642</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t643" class="pln"><span class="n"><a href="#t643">643</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t644" class="pln"><span class="n"><a href="#t644">644</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t645" class="pln"><span class="n"><a href="#t645">645</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t646" class="pln"><span class="n"><a href="#t646">646</a></span><span class="t"><span class="str">                cog.outl("hello")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t647" class="pln"><span class="n"><a href="#t647">647</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t648" class="pln"><span class="n"><a href="#t648">648</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t649" class="pln"><span class="n"><a href="#t649">649</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t650" class="pln"><span class="n"><a href="#t650">650</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t651" class="mis show_mis"><span class="n"><a href="#t651">651</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">isBad</span><span class="op">(</span><span class="nam">infile2</span><span class="op">,</span> <span class="str">"infile.txt(8): Unexpected ']]]'"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t652" class="pln"><span class="n"><a href="#t652">652</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t653" class="pln"><span class="n"><a href="#t653">653</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t654" class="run"><span class="n"><a href="#t654">654</a></span><span class="t"><span class="key">class</span> <span class="nam">CogErrorTests</span><span class="op">(</span><span class="nam">TestCase</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t655" class="pln"><span class="n"><a href="#t655">655</a></span><span class="t">    <span class="str">""" Test cases for cog.error().</span>&nbsp;</span><span class="r"></span></p>
    <p id="t656" class="pln"><span class="n"><a href="#t656">656</a></span><span class="t"><span class="str">    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t657" class="pln"><span class="n"><a href="#t657">657</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t658" class="run"><span class="n"><a href="#t658">658</a></span><span class="t">    <span class="key">def</span> <span class="nam">testErrorMsg</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t659" class="mis show_mis"><span class="n"><a href="#t659">659</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t660" class="pln"><span class="n"><a href="#t660">660</a></span><span class="t"><span class="str">            [[[cog cog.error("This ain't right!")]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t661" class="pln"><span class="n"><a href="#t661">661</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t662" class="pln"><span class="n"><a href="#t662">662</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t663" class="pln"><span class="n"><a href="#t663">663</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t664" class="mis show_mis"><span class="n"><a href="#t664">664</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t665" class="mis show_mis"><span class="n"><a href="#t665">665</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogGeneratedError</span><span class="op">,</span> <span class="str">"^This ain't right!$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t666" class="mis show_mis"><span class="n"><a href="#t666">666</a></span><span class="t">            <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t667" class="pln"><span class="n"><a href="#t667">667</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t668" class="run"><span class="n"><a href="#t668">668</a></span><span class="t">    <span class="key">def</span> <span class="nam">testErrorNoMsg</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t669" class="mis show_mis"><span class="n"><a href="#t669">669</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t670" class="pln"><span class="n"><a href="#t670">670</a></span><span class="t"><span class="str">            [[[cog cog.error()]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t671" class="pln"><span class="n"><a href="#t671">671</a></span><span class="t"><span class="str">            [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t672" class="pln"><span class="n"><a href="#t672">672</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t673" class="pln"><span class="n"><a href="#t673">673</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t674" class="mis show_mis"><span class="n"><a href="#t674">674</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t675" class="mis show_mis"><span class="n"><a href="#t675">675</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogGeneratedError</span><span class="op">,</span> <span class="str">"^Error raised by cog generator.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t676" class="mis show_mis"><span class="n"><a href="#t676">676</a></span><span class="t">            <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t677" class="pln"><span class="n"><a href="#t677">677</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t678" class="run"><span class="n"><a href="#t678">678</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoErrorIfErrorNotCalled</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t679" class="mis show_mis"><span class="n"><a href="#t679">679</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t680" class="pln"><span class="n"><a href="#t680">680</a></span><span class="t"><span class="str">            --[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t681" class="pln"><span class="n"><a href="#t681">681</a></span><span class="t"><span class="str">            --import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t682" class="pln"><span class="n"><a href="#t682">682</a></span><span class="t"><span class="str">            --for i in range(3):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t683" class="pln"><span class="n"><a href="#t683">683</a></span><span class="t"><span class="str">            --    if i > 10:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t684" class="pln"><span class="n"><a href="#t684">684</a></span><span class="t"><span class="str">            --        cog.error("Something is amiss!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t685" class="pln"><span class="n"><a href="#t685">685</a></span><span class="t"><span class="str">            --    cog.out("xx%d\\n" % i)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t686" class="pln"><span class="n"><a href="#t686">686</a></span><span class="t"><span class="str">            --]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t687" class="pln"><span class="n"><a href="#t687">687</a></span><span class="t"><span class="str">            xx0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t688" class="pln"><span class="n"><a href="#t688">688</a></span><span class="t"><span class="str">            xx1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t689" class="pln"><span class="n"><a href="#t689">689</a></span><span class="t"><span class="str">            xx2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t690" class="pln"><span class="n"><a href="#t690">690</a></span><span class="t"><span class="str">            --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t691" class="pln"><span class="n"><a href="#t691">691</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t692" class="pln"><span class="n"><a href="#t692">692</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t693" class="mis show_mis"><span class="n"><a href="#t693">693</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t694" class="mis show_mis"><span class="n"><a href="#t694">694</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t695" class="pln"><span class="n"><a href="#t695">695</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t696" class="pln"><span class="n"><a href="#t696">696</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t697" class="run"><span class="n"><a href="#t697">697</a></span><span class="t"><span class="key">class</span> <span class="nam">CogGeneratorGetCodeTests</span><span class="op">(</span><span class="nam">TestCase</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t698" class="pln"><span class="n"><a href="#t698">698</a></span><span class="t">    <span class="str">""" Unit tests against CogGenerator to see if its getCode() method works</span>&nbsp;</span><span class="r"></span></p>
    <p id="t699" class="pln"><span class="n"><a href="#t699">699</a></span><span class="t"><span class="str">        properly.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t700" class="pln"><span class="n"><a href="#t700">700</a></span><span class="t"><span class="str">    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t701" class="pln"><span class="n"><a href="#t701">701</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t702" class="run"><span class="n"><a href="#t702">702</a></span><span class="t">    <span class="key">def</span> <span class="nam">setUp</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t703" class="pln"><span class="n"><a href="#t703">703</a></span><span class="t">        <span class="str">""" All tests get a generator to use, and short same-length names for</span>&nbsp;</span><span class="r"></span></p>
    <p id="t704" class="pln"><span class="n"><a href="#t704">704</a></span><span class="t"><span class="str">            the functions we're going to use.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t705" class="pln"><span class="n"><a href="#t705">705</a></span><span class="t"><span class="str">        """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t706" class="mis show_mis"><span class="n"><a href="#t706">706</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">gen</span> <span class="op">=</span> <span class="nam">CogGenerator</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t707" class="mis show_mis"><span class="n"><a href="#t707">707</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">parseMarker</span>&nbsp;</span><span class="r"></span></p>
    <p id="t708" class="mis show_mis"><span class="n"><a href="#t708">708</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">parseLine</span>&nbsp;</span><span class="r"></span></p>
    <p id="t709" class="pln"><span class="n"><a href="#t709">709</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t710" class="run"><span class="n"><a href="#t710">710</a></span><span class="t">    <span class="key">def</span> <span class="nam">testEmpty</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t711" class="mis show_mis"><span class="n"><a href="#t711">711</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// [[[cog'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t712" class="mis show_mis"><span class="n"><a href="#t712">712</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// ]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t713" class="mis show_mis"><span class="n"><a href="#t713">713</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">''</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t714" class="pln"><span class="n"><a href="#t714">714</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t715" class="run"><span class="n"><a href="#t715">715</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSimple</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t716" class="mis show_mis"><span class="n"><a href="#t716">716</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// [[[cog'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t717" class="mis show_mis"><span class="n"><a href="#t717">717</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'  print "hello"'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t718" class="mis show_mis"><span class="n"><a href="#t718">718</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'  print "bye"'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t719" class="mis show_mis"><span class="n"><a href="#t719">719</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// ]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t720" class="mis show_mis"><span class="n"><a href="#t720">720</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'print "hello"\nprint "bye"'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t721" class="pln"><span class="n"><a href="#t721">721</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t722" class="run"><span class="n"><a href="#t722">722</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCompressed1</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t723" class="pln"><span class="n"><a href="#t723">723</a></span><span class="t">        <span class="com"># For a while, I supported compressed code blocks, but no longer.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t724" class="mis show_mis"><span class="n"><a href="#t724">724</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// [[[cog: print """'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t725" class="mis show_mis"><span class="n"><a href="#t725">725</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'// hello'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t726" class="mis show_mis"><span class="n"><a href="#t726">726</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'// bye'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t727" class="mis show_mis"><span class="n"><a href="#t727">727</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// """)]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t728" class="mis show_mis"><span class="n"><a href="#t728">728</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'hello\nbye'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t729" class="pln"><span class="n"><a href="#t729">729</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t730" class="run"><span class="n"><a href="#t730">730</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCompressed2</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t731" class="pln"><span class="n"><a href="#t731">731</a></span><span class="t">        <span class="com"># For a while, I supported compressed code blocks, but no longer.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t732" class="mis show_mis"><span class="n"><a href="#t732">732</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// [[[cog: print """'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t733" class="mis show_mis"><span class="n"><a href="#t733">733</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'hello'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t734" class="mis show_mis"><span class="n"><a href="#t734">734</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'bye'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t735" class="mis show_mis"><span class="n"><a href="#t735">735</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// """)]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t736" class="mis show_mis"><span class="n"><a href="#t736">736</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'hello\nbye'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t737" class="pln"><span class="n"><a href="#t737">737</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t738" class="run"><span class="n"><a href="#t738">738</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCompressed3</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t739" class="pln"><span class="n"><a href="#t739">739</a></span><span class="t">        <span class="com"># For a while, I supported compressed code blocks, but no longer.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t740" class="mis show_mis"><span class="n"><a href="#t740">740</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// [[[cog'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t741" class="mis show_mis"><span class="n"><a href="#t741">741</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'print """hello'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t742" class="mis show_mis"><span class="n"><a href="#t742">742</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'bye'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t743" class="mis show_mis"><span class="n"><a href="#t743">743</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// """)]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t744" class="mis show_mis"><span class="n"><a href="#t744">744</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'print """hello\nbye'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t745" class="pln"><span class="n"><a href="#t745">745</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t746" class="run"><span class="n"><a href="#t746">746</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCompressed4</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t747" class="pln"><span class="n"><a href="#t747">747</a></span><span class="t">        <span class="com"># For a while, I supported compressed code blocks, but no longer.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t748" class="mis show_mis"><span class="n"><a href="#t748">748</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// [[[cog: print """'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t749" class="mis show_mis"><span class="n"><a href="#t749">749</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'hello'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t750" class="mis show_mis"><span class="n"><a href="#t750">750</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'bye""")'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t751" class="mis show_mis"><span class="n"><a href="#t751">751</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'// ]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t752" class="mis show_mis"><span class="n"><a href="#t752">752</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'hello\nbye""")'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t753" class="pln"><span class="n"><a href="#t753">753</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t754" class="run"><span class="n"><a href="#t754">754</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoCommonPrefixForMarkers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t755" class="pln"><span class="n"><a href="#t755">755</a></span><span class="t">        <span class="com"># It's important to be able to use #if 0 to hide lines from a</span>&nbsp;</span><span class="r"></span></p>
    <p id="t756" class="pln"><span class="n"><a href="#t756">756</a></span><span class="t">        <span class="com"># C++ compiler.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t757" class="mis show_mis"><span class="n"><a href="#t757">757</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'#if 0 //[[[cog'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t758" class="mis show_mis"><span class="n"><a href="#t758">758</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'\timport cog, sys'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t759" class="mis show_mis"><span class="n"><a href="#t759">759</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">''</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t760" class="mis show_mis"><span class="n"><a href="#t760">760</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">l</span><span class="op">(</span><span class="str">'\tprint sys.argv'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t761" class="mis show_mis"><span class="n"><a href="#t761">761</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">m</span><span class="op">(</span><span class="str">'#endif //]]]'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t762" class="mis show_mis"><span class="n"><a href="#t762">762</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">gen</span><span class="op">.</span><span class="nam">getCode</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'import cog, sys\n\nprint sys.argv'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t763" class="pln"><span class="n"><a href="#t763">763</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t764" class="pln"><span class="n"><a href="#t764">764</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t765" class="run"><span class="n"><a href="#t765">765</a></span><span class="t"><span class="key">class</span> <span class="nam">TestCaseWithTempDir</span><span class="op">(</span><span class="nam">TestCase</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t766" class="pln"><span class="n"><a href="#t766">766</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t767" class="run"><span class="n"><a href="#t767">767</a></span><span class="t">    <span class="key">def</span> <span class="nam">newCog</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t768" class="pln"><span class="n"><a href="#t768">768</a></span><span class="t">        <span class="str">""" Initialize the cog members for another run.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t769" class="pln"><span class="n"><a href="#t769">769</a></span><span class="t"><span class="str">        """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t770" class="pln"><span class="n"><a href="#t770">770</a></span><span class="t">        <span class="com"># Create a cog engine, and catch its output.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t771" class="mis show_mis"><span class="n"><a href="#t771">771</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span> <span class="op">=</span> <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t772" class="mis show_mis"><span class="n"><a href="#t772">772</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">output</span> <span class="op">=</span> <span class="nam">StringIO</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t773" class="mis show_mis"><span class="n"><a href="#t773">773</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">setOutput</span><span class="op">(</span><span class="nam">stdout</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">,</span> <span class="nam">stderr</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t774" class="pln"><span class="n"><a href="#t774">774</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t775" class="run"><span class="n"><a href="#t775">775</a></span><span class="t">    <span class="key">def</span> <span class="nam">setUp</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t776" class="pln"><span class="n"><a href="#t776">776</a></span><span class="t">        <span class="com"># Create a temporary directory.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t777" class="mis show_mis"><span class="n"><a href="#t777">777</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">tempfile</span><span class="op">.</span><span class="nam">gettempdir</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">'testcog_tempdir_'</span> <span class="op">+</span> <span class="nam">str</span><span class="op">(</span><span class="nam">random</span><span class="op">.</span><span class="nam">random</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t778" class="mis show_mis"><span class="n"><a href="#t778">778</a></span><span class="t">        <span class="nam">os</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t779" class="mis show_mis"><span class="n"><a href="#t779">779</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">olddir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">getcwd</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t780" class="mis show_mis"><span class="n"><a href="#t780">780</a></span><span class="t">        <span class="nam">os</span><span class="op">.</span><span class="nam">chdir</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t781" class="mis show_mis"><span class="n"><a href="#t781">781</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t782" class="pln"><span class="n"><a href="#t782">782</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t783" class="run"><span class="n"><a href="#t783">783</a></span><span class="t">    <span class="key">def</span> <span class="nam">tearDown</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t784" class="mis show_mis"><span class="n"><a href="#t784">784</a></span><span class="t">        <span class="nam">os</span><span class="op">.</span><span class="nam">chdir</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">olddir</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t785" class="pln"><span class="n"><a href="#t785">785</a></span><span class="t">        <span class="com"># Get rid of the temporary directory.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t786" class="mis show_mis"><span class="n"><a href="#t786">786</a></span><span class="t">        <span class="nam">shutil</span><span class="op">.</span><span class="nam">rmtree</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t787" class="pln"><span class="n"><a href="#t787">787</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t788" class="run"><span class="n"><a href="#t788">788</a></span><span class="t">    <span class="key">def</span> <span class="nam">assertFilesSame</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">sFName1</span><span class="op">,</span> <span class="nam">sFName2</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t789" class="mis show_mis"><span class="n"><a href="#t789">789</a></span><span class="t">        <span class="nam">text1</span> <span class="op">=</span> <span class="nam">open</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">,</span> <span class="nam">sFName1</span><span class="op">)</span><span class="op">,</span> <span class="str">'rb'</span><span class="op">)</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t790" class="mis show_mis"><span class="n"><a href="#t790">790</a></span><span class="t">        <span class="nam">text2</span> <span class="op">=</span> <span class="nam">open</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">,</span> <span class="nam">sFName2</span><span class="op">)</span><span class="op">,</span> <span class="str">'rb'</span><span class="op">)</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t791" class="mis show_mis"><span class="n"><a href="#t791">791</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">text1</span><span class="op">,</span> <span class="nam">text2</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t792" class="pln"><span class="n"><a href="#t792">792</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t793" class="run"><span class="n"><a href="#t793">793</a></span><span class="t">    <span class="key">def</span> <span class="nam">assertFileContent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">sFName</span><span class="op">,</span> <span class="nam">sContent</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t794" class="mis show_mis"><span class="n"><a href="#t794">794</a></span><span class="t">        <span class="nam">sAbsName</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">,</span> <span class="nam">sFName</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t795" class="mis show_mis"><span class="n"><a href="#t795">795</a></span><span class="t">        <span class="nam">f</span> <span class="op">=</span> <span class="nam">open</span><span class="op">(</span><span class="nam">sAbsName</span><span class="op">,</span> <span class="str">'rb'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t796" class="mis show_mis"><span class="n"><a href="#t796">796</a></span><span class="t">        <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t797" class="mis show_mis"><span class="n"><a href="#t797">797</a></span><span class="t">            <span class="nam">sFileContent</span> <span class="op">=</span> <span class="nam">f</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t798" class="pln"><span class="n"><a href="#t798">798</a></span><span class="t">        <span class="key">finally</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t799" class="mis show_mis"><span class="n"><a href="#t799">799</a></span><span class="t">            <span class="nam">f</span><span class="op">.</span><span class="nam">close</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t800" class="mis show_mis"><span class="n"><a href="#t800">800</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">sFileContent</span><span class="op">,</span> <span class="nam">to_bytes</span><span class="op">(</span><span class="nam">sContent</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t801" class="pln"><span class="n"><a href="#t801">801</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t802" class="pln"><span class="n"><a href="#t802">802</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t803" class="run"><span class="n"><a href="#t803">803</a></span><span class="t"><span class="key">class</span> <span class="nam">ArgumentHandlingTests</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t804" class="pln"><span class="n"><a href="#t804">804</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t805" class="run"><span class="n"><a href="#t805">805</a></span><span class="t">    <span class="key">def</span> <span class="nam">testArgumentFailure</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t806" class="pln"><span class="n"><a href="#t806">806</a></span><span class="t">        <span class="com"># Return value 2 means usage problem.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t807" class="mis show_mis"><span class="n"><a href="#t807">807</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-j'</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> <span class="num">2</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t808" class="mis show_mis"><span class="n"><a href="#t808">808</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t809" class="mis show_mis"><span class="n"><a href="#t809">809</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"option -j not recognized"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t810" class="mis show_mis"><span class="n"><a href="#t810">810</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^No files to process$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t811" class="mis show_mis"><span class="n"><a href="#t811">811</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t812" class="mis show_mis"><span class="n"><a href="#t812">812</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^option -j not recognized$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t813" class="mis show_mis"><span class="n"><a href="#t813">813</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-j'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t814" class="pln"><span class="n"><a href="#t814">814</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t815" class="run"><span class="n"><a href="#t815">815</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNoDashOAndAtFile</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t816" class="mis show_mis"><span class="n"><a href="#t816">816</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t817" class="pln"><span class="n"><a href="#t817">817</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t818" class="pln"><span class="n"><a href="#t818">818</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t819" class="pln"><span class="n"><a href="#t819">819</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t820" class="pln"><span class="n"><a href="#t820">820</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t821" class="pln"><span class="n"><a href="#t821">821</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t822" class="mis show_mis"><span class="n"><a href="#t822">822</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t823" class="mis show_mis"><span class="n"><a href="#t823">823</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^Can't use -o with @file$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t824" class="mis show_mis"><span class="n"><a href="#t824">824</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'foo'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t825" class="pln"><span class="n"><a href="#t825">825</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t826" class="run"><span class="n"><a href="#t826">826</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDashV</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t827" class="mis show_mis"><span class="n"><a href="#t827">827</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-v'</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t828" class="mis show_mis"><span class="n"><a href="#t828">828</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t829" class="mis show_mis"><span class="n"><a href="#t829">829</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="str">'Cog version %s\n'</span> <span class="op">%</span> <span class="nam">__version__</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t830" class="pln"><span class="n"><a href="#t830">830</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t831" class="run"><span class="n"><a href="#t831">831</a></span><span class="t">    <span class="key">def</span> <span class="nam">producesHelp</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">args</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t832" class="mis show_mis"><span class="n"><a href="#t832">832</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t833" class="mis show_mis"><span class="n"><a href="#t833">833</a></span><span class="t">        <span class="nam">argv</span> <span class="op">=</span> <span class="op">[</span><span class="str">'argv0'</span><span class="op">]</span> <span class="op">+</span> <span class="nam">args</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t834" class="mis show_mis"><span class="n"><a href="#t834">834</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span><span class="nam">argv</span><span class="op">)</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t835" class="mis show_mis"><span class="n"><a href="#t835">835</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">usage</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t836" class="pln"><span class="n"><a href="#t836">836</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t837" class="run"><span class="n"><a href="#t837">837</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDashH</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t838" class="pln"><span class="n"><a href="#t838">838</a></span><span class="t">        <span class="com"># -h or -? anywhere on the command line should just print help.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t839" class="mis show_mis"><span class="n"><a href="#t839">839</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">producesHelp</span><span class="op">(</span><span class="str">"-h"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t840" class="mis show_mis"><span class="n"><a href="#t840">840</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">producesHelp</span><span class="op">(</span><span class="str">"-?"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t841" class="mis show_mis"><span class="n"><a href="#t841">841</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">producesHelp</span><span class="op">(</span><span class="str">"fooey.txt -h"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t842" class="mis show_mis"><span class="n"><a href="#t842">842</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">producesHelp</span><span class="op">(</span><span class="str">"-o -r @fooey.txt -? @booey.txt"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t843" class="pln"><span class="n"><a href="#t843">843</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t844" class="run"><span class="n"><a href="#t844">844</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDashOAndDashR</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t845" class="mis show_mis"><span class="n"><a href="#t845">845</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t846" class="pln"><span class="n"><a href="#t846">846</a></span><span class="t">            <span class="str">'cogfile.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t847" class="pln"><span class="n"><a href="#t847">847</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t848" class="pln"><span class="n"><a href="#t848">848</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t849" class="pln"><span class="n"><a href="#t849">849</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t850" class="pln"><span class="n"><a href="#t850">850</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t851" class="mis show_mis"><span class="n"><a href="#t851">851</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t852" class="mis show_mis"><span class="n"><a href="#t852">852</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^Can't use -o with -r \(they are opposites\)$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t853" class="mis show_mis"><span class="n"><a href="#t853">853</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'foo'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'cogfile.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t854" class="pln"><span class="n"><a href="#t854">854</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t855" class="run"><span class="n"><a href="#t855">855</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDashZ</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t856" class="mis show_mis"><span class="n"><a href="#t856">856</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t857" class="pln"><span class="n"><a href="#t857">857</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t858" class="pln"><span class="n"><a href="#t858">858</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t859" class="pln"><span class="n"><a href="#t859">859</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t860" class="pln"><span class="n"><a href="#t860">860</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t861" class="pln"><span class="n"><a href="#t861">861</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t862" class="pln"><span class="n"><a href="#t862">862</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t863" class="pln"><span class="n"><a href="#t863">863</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t864" class="pln"><span class="n"><a href="#t864">864</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t865" class="pln"><span class="n"><a href="#t865">865</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t866" class="pln"><span class="n"><a href="#t866">866</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t867" class="pln"><span class="n"><a href="#t867">867</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t868" class="pln"><span class="n"><a href="#t868">868</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t869" class="pln"><span class="n"><a href="#t869">869</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t870" class="pln"><span class="n"><a href="#t870">870</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t871" class="pln"><span class="n"><a href="#t871">871</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t872" class="pln"><span class="n"><a href="#t872">872</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t873" class="pln"><span class="n"><a href="#t873">873</a></span><span class="t"><span class="str">                void DoSomething();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t874" class="pln"><span class="n"><a href="#t874">874</a></span><span class="t"><span class="str">                void DoAnotherThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t875" class="pln"><span class="n"><a href="#t875">875</a></span><span class="t"><span class="str">                void DoLastThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t876" class="pln"><span class="n"><a href="#t876">876</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t877" class="pln"><span class="n"><a href="#t877">877</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t878" class="pln"><span class="n"><a href="#t878">878</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t879" class="mis show_mis"><span class="n"><a href="#t879">879</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t880" class="mis show_mis"><span class="n"><a href="#t880">880</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">r"^test.cog\(6\): Missing '\[\[\[end\]\]\]' before end of file.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t881" class="mis show_mis"><span class="n"><a href="#t881">881</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t882" class="mis show_mis"><span class="n"><a href="#t882">882</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t883" class="mis show_mis"><span class="n"><a href="#t883">883</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-z'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t884" class="mis show_mis"><span class="n"><a href="#t884">884</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t885" class="pln"><span class="n"><a href="#t885">885</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t886" class="run"><span class="n"><a href="#t886">886</a></span><span class="t">    <span class="key">def</span> <span class="nam">testBadDashD</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t887" class="mis show_mis"><span class="n"><a href="#t887">887</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^-D takes a name=value argument$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t888" class="mis show_mis"><span class="n"><a href="#t888">888</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-Dfooey'</span><span class="op">,</span> <span class="str">'cog.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t889" class="mis show_mis"><span class="n"><a href="#t889">889</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^-D takes a name=value argument$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t890" class="mis show_mis"><span class="n"><a href="#t890">890</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-D'</span><span class="op">,</span> <span class="str">'fooey'</span><span class="op">,</span> <span class="str">'cog.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t891" class="pln"><span class="n"><a href="#t891">891</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t892" class="run"><span class="n"><a href="#t892">892</a></span><span class="t">    <span class="key">def</span> <span class="nam">testBadMarkers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t893" class="mis show_mis"><span class="n"><a href="#t893">893</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^--markers requires 3 values separated by spaces, could not parse 'X'$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t894" class="mis show_mis"><span class="n"><a href="#t894">894</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'--markers=X'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t895" class="mis show_mis"><span class="n"><a href="#t895">895</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^--markers requires 3 values separated by spaces, could not parse 'A B C D'$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t896" class="mis show_mis"><span class="n"><a href="#t896">896</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'--markers=A B C D'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t897" class="pln"><span class="n"><a href="#t897">897</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t898" class="pln"><span class="n"><a href="#t898">898</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t899" class="run"><span class="n"><a href="#t899">899</a></span><span class="t"><span class="key">class</span> <span class="nam">TestMain</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t900" class="run"><span class="n"><a href="#t900">900</a></span><span class="t">    <span class="key">def</span> <span class="nam">setUp</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t901" class="mis show_mis"><span class="n"><a href="#t901">901</a></span><span class="t">        <span class="nam">super</span><span class="op">(</span><span class="nam">TestMain</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">setUp</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t902" class="mis show_mis"><span class="n"><a href="#t902">902</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">old_argv</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span><span class="op">[</span><span class="op">:</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t903" class="mis show_mis"><span class="n"><a href="#t903">903</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">old_stderr</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span>&nbsp;</span><span class="r"></span></p>
    <p id="t904" class="mis show_mis"><span class="n"><a href="#t904">904</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span> <span class="op">=</span> <span class="nam">StringIO</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t905" class="pln"><span class="n"><a href="#t905">905</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t906" class="run"><span class="n"><a href="#t906">906</a></span><span class="t">    <span class="key">def</span> <span class="nam">tearDown</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t907" class="mis show_mis"><span class="n"><a href="#t907">907</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">old_stderr</span>&nbsp;</span><span class="r"></span></p>
    <p id="t908" class="mis show_mis"><span class="n"><a href="#t908">908</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">old_argv</span>&nbsp;</span><span class="r"></span></p>
    <p id="t909" class="mis show_mis"><span class="n"><a href="#t909">909</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">modules</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="str">'mycode'</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t910" class="mis show_mis"><span class="n"><a href="#t910">910</a></span><span class="t">        <span class="nam">super</span><span class="op">(</span><span class="nam">TestMain</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">tearDown</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t911" class="pln"><span class="n"><a href="#t911">911</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t912" class="run"><span class="n"><a href="#t912">912</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_main_function</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t913" class="mis show_mis"><span class="n"><a href="#t913">913</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span> <span class="op">=</span> <span class="op">[</span><span class="str">"argv0"</span><span class="op">,</span> <span class="str">"-Z"</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t914" class="mis show_mis"><span class="n"><a href="#t914">914</a></span><span class="t">        <span class="nam">ret</span> <span class="op">=</span> <span class="nam">main</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t915" class="mis show_mis"><span class="n"><a href="#t915">915</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">ret</span><span class="op">,</span> <span class="num">2</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t916" class="mis show_mis"><span class="n"><a href="#t916">916</a></span><span class="t">        <span class="nam">stderr</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t917" class="mis show_mis"><span class="n"><a href="#t917">917</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">stderr</span><span class="op">,</span> <span class="str">'option -Z not recognized\n(for help use -?)\n'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t918" class="pln"><span class="n"><a href="#t918">918</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t919" class="run"><span class="n"><a href="#t919">919</a></span><span class="t">    <span class="nam">files</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t920" class="pln"><span class="n"><a href="#t920">920</a></span><span class="t">        <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t921" class="pln"><span class="n"><a href="#t921">921</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t922" class="pln"><span class="n"><a href="#t922">922</a></span><span class="t"><span class="str">            def func():</span>&nbsp;</span><span class="r"></span></p>
    <p id="t923" class="pln"><span class="n"><a href="#t923">923</a></span><span class="t"><span class="str">                import mycode</span>&nbsp;</span><span class="r"></span></p>
    <p id="t924" class="pln"><span class="n"><a href="#t924">924</a></span><span class="t"><span class="str">                mycode.boom()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t925" class="pln"><span class="n"><a href="#t925">925</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t926" class="pln"><span class="n"><a href="#t926">926</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t927" class="pln"><span class="n"><a href="#t927">927</a></span><span class="t"><span class="str">            -----</span>&nbsp;</span><span class="r"></span></p>
    <p id="t928" class="pln"><span class="n"><a href="#t928">928</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t929" class="pln"><span class="n"><a href="#t929">929</a></span><span class="t"><span class="str">            func()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t930" class="pln"><span class="n"><a href="#t930">930</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t931" class="pln"><span class="n"><a href="#t931">931</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t932" class="pln"><span class="n"><a href="#t932">932</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t933" class="pln"><span class="n"><a href="#t933">933</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t934" class="pln"><span class="n"><a href="#t934">934</a></span><span class="t">        <span class="str">'mycode.py'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t935" class="pln"><span class="n"><a href="#t935">935</a></span><span class="t"><span class="str">            def boom():</span>&nbsp;</span><span class="r"></span></p>
    <p id="t936" class="pln"><span class="n"><a href="#t936">936</a></span><span class="t"><span class="str">                [][0]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t937" class="pln"><span class="n"><a href="#t937">937</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t938" class="pln"><span class="n"><a href="#t938">938</a></span><span class="t">        <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t939" class="pln"><span class="n"><a href="#t939">939</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t940" class="run"><span class="n"><a href="#t940">940</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_error_report</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t941" class="mis show_mis"><span class="n"><a href="#t941">941</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">check_error_report</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t942" class="pln"><span class="n"><a href="#t942">942</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t943" class="run"><span class="n"><a href="#t943">943</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_error_report_with_prologue</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t944" class="mis show_mis"><span class="n"><a href="#t944">944</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">check_error_report</span><span class="op">(</span><span class="str">"-p"</span><span class="op">,</span> <span class="str">"#1\n#2"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t945" class="pln"><span class="n"><a href="#t945">945</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t946" class="run"><span class="n"><a href="#t946">946</a></span><span class="t">    <span class="key">def</span> <span class="nam">check_error_report</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="nam">args</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t947" class="pln"><span class="n"><a href="#t947">947</a></span><span class="t">        <span class="str">"""Check that the error report is right."""</span>&nbsp;</span><span class="r"></span></p>
    <p id="t948" class="mis show_mis"><span class="n"><a href="#t948">948</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">files</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t949" class="mis show_mis"><span class="n"><a href="#t949">949</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span> <span class="op">=</span> <span class="op">[</span><span class="str">"argv0"</span><span class="op">]</span> <span class="op">+</span> <span class="nam">list</span><span class="op">(</span><span class="nam">args</span><span class="op">)</span> <span class="op">+</span> <span class="op">[</span><span class="str">"-r"</span><span class="op">,</span> <span class="str">"test.cog"</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t950" class="mis show_mis"><span class="n"><a href="#t950">950</a></span><span class="t">        <span class="nam">main</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t951" class="mis show_mis"><span class="n"><a href="#t951">951</a></span><span class="t">        <span class="nam">expected</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t952" class="pln"><span class="n"><a href="#t952">952</a></span><span class="t"><span class="str">            Traceback (most recent call last):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t953" class="pln"><span class="n"><a href="#t953">953</a></span><span class="t"><span class="str">              File "test.cog", line 9, in &lt;module></span>&nbsp;</span><span class="r"></span></p>
    <p id="t954" class="pln"><span class="n"><a href="#t954">954</a></span><span class="t"><span class="str">                func()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t955" class="pln"><span class="n"><a href="#t955">955</a></span><span class="t"><span class="str">              File "test.cog", line 4, in func</span>&nbsp;</span><span class="r"></span></p>
    <p id="t956" class="pln"><span class="n"><a href="#t956">956</a></span><span class="t"><span class="str">                mycode.boom()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t957" class="pln"><span class="n"><a href="#t957">957</a></span><span class="t"><span class="str">              File "MYCODE", line 2, in boom</span>&nbsp;</span><span class="r"></span></p>
    <p id="t958" class="pln"><span class="n"><a href="#t958">958</a></span><span class="t"><span class="str">                [][0]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t959" class="pln"><span class="n"><a href="#t959">959</a></span><span class="t"><span class="str">            IndexError: list index out of range</span>&nbsp;</span><span class="r"></span></p>
    <p id="t960" class="pln"><span class="n"><a href="#t960">960</a></span><span class="t"><span class="str">            """</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t961" class="mis show_mis"><span class="n"><a href="#t961">961</a></span><span class="t">        <span class="key">if</span> <span class="nam">PY3</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t962" class="mis show_mis"><span class="n"><a href="#t962">962</a></span><span class="t">            <span class="nam">expected</span> <span class="op">=</span> <span class="nam">expected</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"MYCODE"</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">abspath</span><span class="op">(</span><span class="str">"mycode.py"</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t963" class="pln"><span class="n"><a href="#t963">963</a></span><span class="t">        <span class="key">else</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t964" class="mis show_mis"><span class="n"><a href="#t964">964</a></span><span class="t">            <span class="nam">expected</span> <span class="op">=</span> <span class="nam">expected</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"MYCODE"</span><span class="op">,</span> <span class="str">"mycode.py"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t965" class="mis show_mis"><span class="n"><a href="#t965">965</a></span><span class="t">        <span class="key">assert</span> <span class="nam">expected</span> <span class="op">==</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t966" class="pln"><span class="n"><a href="#t966">966</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t967" class="run"><span class="n"><a href="#t967">967</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_error_in_prologue</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t968" class="mis show_mis"><span class="n"><a href="#t968">968</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">files</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t969" class="mis show_mis"><span class="n"><a href="#t969">969</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span> <span class="op">=</span> <span class="op">[</span><span class="str">"argv0"</span><span class="op">,</span> <span class="str">"-p"</span><span class="op">,</span> <span class="str">"import mycode; mycode.boom()"</span><span class="op">,</span> <span class="str">"-r"</span><span class="op">,</span> <span class="str">"test.cog"</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t970" class="mis show_mis"><span class="n"><a href="#t970">970</a></span><span class="t">        <span class="nam">main</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t971" class="mis show_mis"><span class="n"><a href="#t971">971</a></span><span class="t">        <span class="nam">expected</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t972" class="pln"><span class="n"><a href="#t972">972</a></span><span class="t"><span class="str">            Traceback (most recent call last):</span>&nbsp;</span><span class="r"></span></p>
    <p id="t973" class="pln"><span class="n"><a href="#t973">973</a></span><span class="t"><span class="str">              File "&lt;prologue>", line 1, in &lt;module></span>&nbsp;</span><span class="r"></span></p>
    <p id="t974" class="pln"><span class="n"><a href="#t974">974</a></span><span class="t"><span class="str">                import mycode; mycode.boom()</span>&nbsp;</span><span class="r"></span></p>
    <p id="t975" class="pln"><span class="n"><a href="#t975">975</a></span><span class="t"><span class="str">              File "MYCODE", line 2, in boom</span>&nbsp;</span><span class="r"></span></p>
    <p id="t976" class="pln"><span class="n"><a href="#t976">976</a></span><span class="t"><span class="str">                [][0]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t977" class="pln"><span class="n"><a href="#t977">977</a></span><span class="t"><span class="str">            IndexError: list index out of range</span>&nbsp;</span><span class="r"></span></p>
    <p id="t978" class="pln"><span class="n"><a href="#t978">978</a></span><span class="t"><span class="str">            """</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t979" class="mis show_mis"><span class="n"><a href="#t979">979</a></span><span class="t">        <span class="key">if</span> <span class="nam">PY3</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t980" class="mis show_mis"><span class="n"><a href="#t980">980</a></span><span class="t">            <span class="nam">expected</span> <span class="op">=</span> <span class="nam">expected</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"MYCODE"</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">abspath</span><span class="op">(</span><span class="str">"mycode.py"</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t981" class="pln"><span class="n"><a href="#t981">981</a></span><span class="t">        <span class="key">else</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t982" class="mis show_mis"><span class="n"><a href="#t982">982</a></span><span class="t">            <span class="nam">expected</span> <span class="op">=</span> <span class="nam">expected</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"MYCODE"</span><span class="op">,</span> <span class="str">"mycode.py"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t983" class="mis show_mis"><span class="n"><a href="#t983">983</a></span><span class="t">        <span class="key">assert</span> <span class="nam">expected</span> <span class="op">==</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t984" class="pln"><span class="n"><a href="#t984">984</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t985" class="pln"><span class="n"><a href="#t985">985</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t986" class="pln"><span class="n"><a href="#t986">986</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t987" class="run"><span class="n"><a href="#t987">987</a></span><span class="t"><span class="key">class</span> <span class="nam">TestFileHandling</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t988" class="pln"><span class="n"><a href="#t988">988</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t989" class="run"><span class="n"><a href="#t989">989</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSimple</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t990" class="mis show_mis"><span class="n"><a href="#t990">990</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t991" class="pln"><span class="n"><a href="#t991">991</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t992" class="pln"><span class="n"><a href="#t992">992</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t993" class="pln"><span class="n"><a href="#t993">993</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t994" class="pln"><span class="n"><a href="#t994">994</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t995" class="pln"><span class="n"><a href="#t995">995</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t996" class="pln"><span class="n"><a href="#t996">996</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t997" class="pln"><span class="n"><a href="#t997">997</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t998" class="pln"><span class="n"><a href="#t998">998</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t999" class="pln"><span class="n"><a href="#t999">999</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1000" class="pln"><span class="n"><a href="#t1000">1000</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1001" class="pln"><span class="n"><a href="#t1001">1001</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1002" class="pln"><span class="n"><a href="#t1002">1002</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1003" class="pln"><span class="n"><a href="#t1003">1003</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1004" class="pln"><span class="n"><a href="#t1004">1004</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1005" class="pln"><span class="n"><a href="#t1005">1005</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1006" class="pln"><span class="n"><a href="#t1006">1006</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1007" class="pln"><span class="n"><a href="#t1007">1007</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1008" class="pln"><span class="n"><a href="#t1008">1008</a></span><span class="t"><span class="str">                void DoSomething();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1009" class="pln"><span class="n"><a href="#t1009">1009</a></span><span class="t"><span class="str">                void DoAnotherThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1010" class="pln"><span class="n"><a href="#t1010">1010</a></span><span class="t"><span class="str">                void DoLastThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1011" class="pln"><span class="n"><a href="#t1011">1011</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1012" class="pln"><span class="n"><a href="#t1012">1012</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1013" class="pln"><span class="n"><a href="#t1013">1013</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1014" class="pln"><span class="n"><a href="#t1014">1014</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1015" class="mis show_mis"><span class="n"><a href="#t1015">1015</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1016" class="mis show_mis"><span class="n"><a href="#t1016">1016</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1017" class="mis show_mis"><span class="n"><a href="#t1017">1017</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1018" class="mis show_mis"><span class="n"><a href="#t1018">1018</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1019" class="mis show_mis"><span class="n"><a href="#t1019">1019</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1020" class="pln"><span class="n"><a href="#t1020">1020</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1021" class="run"><span class="n"><a href="#t1021">1021</a></span><span class="t">    <span class="key">def</span> <span class="nam">testWildcards</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1022" class="mis show_mis"><span class="n"><a href="#t1022">1022</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1023" class="pln"><span class="n"><a href="#t1023">1023</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1024" class="pln"><span class="n"><a href="#t1024">1024</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1025" class="pln"><span class="n"><a href="#t1025">1025</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1026" class="pln"><span class="n"><a href="#t1026">1026</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1027" class="pln"><span class="n"><a href="#t1027">1027</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1028" class="pln"><span class="n"><a href="#t1028">1028</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1029" class="pln"><span class="n"><a href="#t1029">1029</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1030" class="pln"><span class="n"><a href="#t1030">1030</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1031" class="pln"><span class="n"><a href="#t1031">1031</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1032" class="pln"><span class="n"><a href="#t1032">1032</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1033" class="pln"><span class="n"><a href="#t1033">1033</a></span><span class="t">            <span class="str">'test2.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1034" class="pln"><span class="n"><a href="#t1034">1034</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1035" class="pln"><span class="n"><a href="#t1035">1035</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1036" class="pln"><span class="n"><a href="#t1036">1036</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1037" class="pln"><span class="n"><a href="#t1037">1037</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1038" class="pln"><span class="n"><a href="#t1038">1038</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1039" class="pln"><span class="n"><a href="#t1039">1039</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1040" class="pln"><span class="n"><a href="#t1040">1040</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1041" class="pln"><span class="n"><a href="#t1041">1041</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1042" class="pln"><span class="n"><a href="#t1042">1042</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1043" class="pln"><span class="n"><a href="#t1043">1043</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1044" class="pln"><span class="n"><a href="#t1044">1044</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1045" class="pln"><span class="n"><a href="#t1045">1045</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1046" class="pln"><span class="n"><a href="#t1046">1046</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1047" class="pln"><span class="n"><a href="#t1047">1047</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1048" class="pln"><span class="n"><a href="#t1048">1048</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1049" class="pln"><span class="n"><a href="#t1049">1049</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1050" class="pln"><span class="n"><a href="#t1050">1050</a></span><span class="t"><span class="str">                void DoSomething();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1051" class="pln"><span class="n"><a href="#t1051">1051</a></span><span class="t"><span class="str">                void DoAnotherThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1052" class="pln"><span class="n"><a href="#t1052">1052</a></span><span class="t"><span class="str">                void DoLastThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1053" class="pln"><span class="n"><a href="#t1053">1053</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1054" class="pln"><span class="n"><a href="#t1054">1054</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1055" class="pln"><span class="n"><a href="#t1055">1055</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1056" class="pln"><span class="n"><a href="#t1056">1056</a></span><span class="t">            <span class="str">'not_this_one.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1057" class="pln"><span class="n"><a href="#t1057">1057</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1058" class="pln"><span class="n"><a href="#t1058">1058</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1059" class="pln"><span class="n"><a href="#t1059">1059</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1060" class="pln"><span class="n"><a href="#t1060">1060</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1061" class="pln"><span class="n"><a href="#t1061">1061</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1062" class="pln"><span class="n"><a href="#t1062">1062</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1063" class="pln"><span class="n"><a href="#t1063">1063</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1064" class="pln"><span class="n"><a href="#t1064">1064</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1065" class="pln"><span class="n"><a href="#t1065">1065</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1066" class="pln"><span class="n"><a href="#t1066">1066</a></span><span class="t">            <span class="str">'not_this_one.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1067" class="pln"><span class="n"><a href="#t1067">1067</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1068" class="pln"><span class="n"><a href="#t1068">1068</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1069" class="pln"><span class="n"><a href="#t1069">1069</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1070" class="pln"><span class="n"><a href="#t1070">1070</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1071" class="pln"><span class="n"><a href="#t1071">1071</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1072" class="pln"><span class="n"><a href="#t1072">1072</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1073" class="pln"><span class="n"><a href="#t1073">1073</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1074" class="pln"><span class="n"><a href="#t1074">1074</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1075" class="pln"><span class="n"><a href="#t1075">1075</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1076" class="pln"><span class="n"><a href="#t1076">1076</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1077" class="mis show_mis"><span class="n"><a href="#t1077">1077</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1078" class="mis show_mis"><span class="n"><a href="#t1078">1078</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'t*.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1079" class="mis show_mis"><span class="n"><a href="#t1079">1079</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1080" class="mis show_mis"><span class="n"><a href="#t1080">1080</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test2.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1081" class="mis show_mis"><span class="n"><a href="#t1081">1081</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'not_this_one.cog'</span><span class="op">,</span> <span class="str">'not_this_one.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1082" class="mis show_mis"><span class="n"><a href="#t1082">1082</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1083" class="mis show_mis"><span class="n"><a href="#t1083">1083</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1084" class="pln"><span class="n"><a href="#t1084">1084</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1085" class="run"><span class="n"><a href="#t1085">1085</a></span><span class="t">    <span class="key">def</span> <span class="nam">testOutputFile</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1086" class="pln"><span class="n"><a href="#t1086">1086</a></span><span class="t">        <span class="com"># -o sets the output file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1087" class="mis show_mis"><span class="n"><a href="#t1087">1087</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1088" class="pln"><span class="n"><a href="#t1088">1088</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1089" class="pln"><span class="n"><a href="#t1089">1089</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1090" class="pln"><span class="n"><a href="#t1090">1090</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1091" class="pln"><span class="n"><a href="#t1091">1091</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1092" class="pln"><span class="n"><a href="#t1092">1092</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1093" class="pln"><span class="n"><a href="#t1093">1093</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1094" class="pln"><span class="n"><a href="#t1094">1094</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1095" class="pln"><span class="n"><a href="#t1095">1095</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1096" class="pln"><span class="n"><a href="#t1096">1096</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1097" class="pln"><span class="n"><a href="#t1097">1097</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1098" class="pln"><span class="n"><a href="#t1098">1098</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1099" class="pln"><span class="n"><a href="#t1099">1099</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1100" class="pln"><span class="n"><a href="#t1100">1100</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1101" class="pln"><span class="n"><a href="#t1101">1101</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1102" class="pln"><span class="n"><a href="#t1102">1102</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1103" class="pln"><span class="n"><a href="#t1103">1103</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1104" class="pln"><span class="n"><a href="#t1104">1104</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1105" class="pln"><span class="n"><a href="#t1105">1105</a></span><span class="t"><span class="str">                void DoSomething();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1106" class="pln"><span class="n"><a href="#t1106">1106</a></span><span class="t"><span class="str">                void DoAnotherThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1107" class="pln"><span class="n"><a href="#t1107">1107</a></span><span class="t"><span class="str">                void DoLastThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1108" class="pln"><span class="n"><a href="#t1108">1108</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1109" class="pln"><span class="n"><a href="#t1109">1109</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1110" class="pln"><span class="n"><a href="#t1110">1110</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1111" class="pln"><span class="n"><a href="#t1111">1111</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1112" class="mis show_mis"><span class="n"><a href="#t1112">1112</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1113" class="mis show_mis"><span class="n"><a href="#t1113">1113</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'in/a/dir/test.cogged'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1114" class="mis show_mis"><span class="n"><a href="#t1114">1114</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'in/a/dir/test.cogged'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1115" class="pln"><span class="n"><a href="#t1115">1115</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1116" class="run"><span class="n"><a href="#t1116">1116</a></span><span class="t">    <span class="key">def</span> <span class="nam">testAtFile</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1117" class="mis show_mis"><span class="n"><a href="#t1117">1117</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1118" class="pln"><span class="n"><a href="#t1118">1118</a></span><span class="t">            <span class="str">'one.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1119" class="pln"><span class="n"><a href="#t1119">1119</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1120" class="pln"><span class="n"><a href="#t1120">1120</a></span><span class="t"><span class="str">                cog.outl("hello world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1121" class="pln"><span class="n"><a href="#t1121">1121</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1122" class="pln"><span class="n"><a href="#t1122">1122</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1123" class="pln"><span class="n"><a href="#t1123">1123</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1124" class="pln"><span class="n"><a href="#t1124">1124</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1125" class="pln"><span class="n"><a href="#t1125">1125</a></span><span class="t">            <span class="str">'one.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1126" class="pln"><span class="n"><a href="#t1126">1126</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1127" class="pln"><span class="n"><a href="#t1127">1127</a></span><span class="t"><span class="str">                cog.outl("hello world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1128" class="pln"><span class="n"><a href="#t1128">1128</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1129" class="pln"><span class="n"><a href="#t1129">1129</a></span><span class="t"><span class="str">                hello world</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1130" class="pln"><span class="n"><a href="#t1130">1130</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1131" class="pln"><span class="n"><a href="#t1131">1131</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1132" class="pln"><span class="n"><a href="#t1132">1132</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1133" class="pln"><span class="n"><a href="#t1133">1133</a></span><span class="t">            <span class="str">'two.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1134" class="pln"><span class="n"><a href="#t1134">1134</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1135" class="pln"><span class="n"><a href="#t1135">1135</a></span><span class="t"><span class="str">                cog.outl("goodbye cruel world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1136" class="pln"><span class="n"><a href="#t1136">1136</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1137" class="pln"><span class="n"><a href="#t1137">1137</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1138" class="pln"><span class="n"><a href="#t1138">1138</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1139" class="pln"><span class="n"><a href="#t1139">1139</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1140" class="pln"><span class="n"><a href="#t1140">1140</a></span><span class="t">            <span class="str">'two.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1141" class="pln"><span class="n"><a href="#t1141">1141</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1142" class="pln"><span class="n"><a href="#t1142">1142</a></span><span class="t"><span class="str">                cog.outl("goodbye cruel world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1143" class="pln"><span class="n"><a href="#t1143">1143</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1144" class="pln"><span class="n"><a href="#t1144">1144</a></span><span class="t"><span class="str">                goodbye cruel world</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1145" class="pln"><span class="n"><a href="#t1145">1145</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1146" class="pln"><span class="n"><a href="#t1146">1146</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1147" class="pln"><span class="n"><a href="#t1147">1147</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1148" class="pln"><span class="n"><a href="#t1148">1148</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1149" class="pln"><span class="n"><a href="#t1149">1149</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1150" class="pln"><span class="n"><a href="#t1150">1150</a></span><span class="t"><span class="str">                one.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1151" class="pln"><span class="n"><a href="#t1151">1151</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1152" class="pln"><span class="n"><a href="#t1152">1152</a></span><span class="t"><span class="str">                two.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1153" class="pln"><span class="n"><a href="#t1153">1153</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1154" class="pln"><span class="n"><a href="#t1154">1154</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1155" class="pln"><span class="n"><a href="#t1155">1155</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1156" class="mis show_mis"><span class="n"><a href="#t1156">1156</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1157" class="mis show_mis"><span class="n"><a href="#t1157">1157</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1158" class="mis show_mis"><span class="n"><a href="#t1158">1158</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'one.cog'</span><span class="op">,</span> <span class="str">'one.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1159" class="mis show_mis"><span class="n"><a href="#t1159">1159</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'two.cog'</span><span class="op">,</span> <span class="str">'two.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1160" class="mis show_mis"><span class="n"><a href="#t1160">1160</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1161" class="mis show_mis"><span class="n"><a href="#t1161">1161</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1162" class="pln"><span class="n"><a href="#t1162">1162</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1163" class="run"><span class="n"><a href="#t1163">1163</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNestedAtFile</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1164" class="mis show_mis"><span class="n"><a href="#t1164">1164</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1165" class="pln"><span class="n"><a href="#t1165">1165</a></span><span class="t">            <span class="str">'one.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1166" class="pln"><span class="n"><a href="#t1166">1166</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1167" class="pln"><span class="n"><a href="#t1167">1167</a></span><span class="t"><span class="str">                cog.outl("hello world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1168" class="pln"><span class="n"><a href="#t1168">1168</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1169" class="pln"><span class="n"><a href="#t1169">1169</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1170" class="pln"><span class="n"><a href="#t1170">1170</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1171" class="pln"><span class="n"><a href="#t1171">1171</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1172" class="pln"><span class="n"><a href="#t1172">1172</a></span><span class="t">            <span class="str">'one.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1173" class="pln"><span class="n"><a href="#t1173">1173</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1174" class="pln"><span class="n"><a href="#t1174">1174</a></span><span class="t"><span class="str">                cog.outl("hello world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1175" class="pln"><span class="n"><a href="#t1175">1175</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1176" class="pln"><span class="n"><a href="#t1176">1176</a></span><span class="t"><span class="str">                hello world</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1177" class="pln"><span class="n"><a href="#t1177">1177</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1178" class="pln"><span class="n"><a href="#t1178">1178</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1179" class="pln"><span class="n"><a href="#t1179">1179</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1180" class="pln"><span class="n"><a href="#t1180">1180</a></span><span class="t">            <span class="str">'two.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1181" class="pln"><span class="n"><a href="#t1181">1181</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1182" class="pln"><span class="n"><a href="#t1182">1182</a></span><span class="t"><span class="str">                cog.outl("goodbye cruel world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1183" class="pln"><span class="n"><a href="#t1183">1183</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1184" class="pln"><span class="n"><a href="#t1184">1184</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1185" class="pln"><span class="n"><a href="#t1185">1185</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1186" class="pln"><span class="n"><a href="#t1186">1186</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1187" class="pln"><span class="n"><a href="#t1187">1187</a></span><span class="t">            <span class="str">'two.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1188" class="pln"><span class="n"><a href="#t1188">1188</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1189" class="pln"><span class="n"><a href="#t1189">1189</a></span><span class="t"><span class="str">                cog.outl("goodbye cruel world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1190" class="pln"><span class="n"><a href="#t1190">1190</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1191" class="pln"><span class="n"><a href="#t1191">1191</a></span><span class="t"><span class="str">                goodbye cruel world</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1192" class="pln"><span class="n"><a href="#t1192">1192</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1193" class="pln"><span class="n"><a href="#t1193">1193</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1194" class="pln"><span class="n"><a href="#t1194">1194</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1195" class="pln"><span class="n"><a href="#t1195">1195</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1196" class="pln"><span class="n"><a href="#t1196">1196</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1197" class="pln"><span class="n"><a href="#t1197">1197</a></span><span class="t"><span class="str">                one.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1198" class="pln"><span class="n"><a href="#t1198">1198</a></span><span class="t"><span class="str">                @cogfiles2.txt</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1199" class="pln"><span class="n"><a href="#t1199">1199</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1200" class="pln"><span class="n"><a href="#t1200">1200</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1201" class="pln"><span class="n"><a href="#t1201">1201</a></span><span class="t">            <span class="str">'cogfiles2.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1202" class="pln"><span class="n"><a href="#t1202">1202</a></span><span class="t"><span class="str">                # This one too, please.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1203" class="pln"><span class="n"><a href="#t1203">1203</a></span><span class="t"><span class="str">                two.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1204" class="pln"><span class="n"><a href="#t1204">1204</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1205" class="pln"><span class="n"><a href="#t1205">1205</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1206" class="pln"><span class="n"><a href="#t1206">1206</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1207" class="mis show_mis"><span class="n"><a href="#t1207">1207</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1208" class="mis show_mis"><span class="n"><a href="#t1208">1208</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1209" class="mis show_mis"><span class="n"><a href="#t1209">1209</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'one.cog'</span><span class="op">,</span> <span class="str">'one.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1210" class="mis show_mis"><span class="n"><a href="#t1210">1210</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'two.cog'</span><span class="op">,</span> <span class="str">'two.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1211" class="mis show_mis"><span class="n"><a href="#t1211">1211</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1212" class="mis show_mis"><span class="n"><a href="#t1212">1212</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1213" class="pln"><span class="n"><a href="#t1213">1213</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1214" class="run"><span class="n"><a href="#t1214">1214</a></span><span class="t">    <span class="key">def</span> <span class="nam">testAtFileWithArgs</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1215" class="mis show_mis"><span class="n"><a href="#t1215">1215</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1216" class="pln"><span class="n"><a href="#t1216">1216</a></span><span class="t">            <span class="str">'both.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1217" class="pln"><span class="n"><a href="#t1217">1217</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1218" class="pln"><span class="n"><a href="#t1218">1218</a></span><span class="t"><span class="str">                cog.outl("one: %s" % ('one' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1219" class="pln"><span class="n"><a href="#t1219">1219</a></span><span class="t"><span class="str">                cog.outl("two: %s" % ('two' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1220" class="pln"><span class="n"><a href="#t1220">1220</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1221" class="pln"><span class="n"><a href="#t1221">1221</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1222" class="pln"><span class="n"><a href="#t1222">1222</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1223" class="pln"><span class="n"><a href="#t1223">1223</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1224" class="pln"><span class="n"><a href="#t1224">1224</a></span><span class="t">            <span class="str">'one.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1225" class="pln"><span class="n"><a href="#t1225">1225</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1226" class="pln"><span class="n"><a href="#t1226">1226</a></span><span class="t"><span class="str">                cog.outl("one: %s" % ('one' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1227" class="pln"><span class="n"><a href="#t1227">1227</a></span><span class="t"><span class="str">                cog.outl("two: %s" % ('two' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1228" class="pln"><span class="n"><a href="#t1228">1228</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1229" class="pln"><span class="n"><a href="#t1229">1229</a></span><span class="t"><span class="str">                one: True // ONE</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1230" class="pln"><span class="n"><a href="#t1230">1230</a></span><span class="t"><span class="str">                two: False // ONE</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1231" class="pln"><span class="n"><a href="#t1231">1231</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1232" class="pln"><span class="n"><a href="#t1232">1232</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1233" class="pln"><span class="n"><a href="#t1233">1233</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1234" class="pln"><span class="n"><a href="#t1234">1234</a></span><span class="t">            <span class="str">'two.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1235" class="pln"><span class="n"><a href="#t1235">1235</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1236" class="pln"><span class="n"><a href="#t1236">1236</a></span><span class="t"><span class="str">                cog.outl("one: %s" % ('one' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1237" class="pln"><span class="n"><a href="#t1237">1237</a></span><span class="t"><span class="str">                cog.outl("two: %s" % ('two' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1238" class="pln"><span class="n"><a href="#t1238">1238</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1239" class="pln"><span class="n"><a href="#t1239">1239</a></span><span class="t"><span class="str">                one: False // TWO</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1240" class="pln"><span class="n"><a href="#t1240">1240</a></span><span class="t"><span class="str">                two: True // TWO</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1241" class="pln"><span class="n"><a href="#t1241">1241</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1242" class="pln"><span class="n"><a href="#t1242">1242</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1243" class="pln"><span class="n"><a href="#t1243">1243</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1244" class="pln"><span class="n"><a href="#t1244">1244</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1245" class="pln"><span class="n"><a href="#t1245">1245</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1246" class="pln"><span class="n"><a href="#t1246">1246</a></span><span class="t"><span class="str">                both.cog -o in/a/dir/both.one -s ' // ONE' -D one=x</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1247" class="pln"><span class="n"><a href="#t1247">1247</a></span><span class="t"><span class="str">                both.cog -o in/a/dir/both.two -s ' // TWO' -D two=x</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1248" class="pln"><span class="n"><a href="#t1248">1248</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1249" class="pln"><span class="n"><a href="#t1249">1249</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1250" class="pln"><span class="n"><a href="#t1250">1250</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1251" class="mis show_mis"><span class="n"><a href="#t1251">1251</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1252" class="mis show_mis"><span class="n"><a href="#t1252">1252</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1253" class="mis show_mis"><span class="n"><a href="#t1253">1253</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'in/a/dir/both.one'</span><span class="op">,</span> <span class="str">'one.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1254" class="mis show_mis"><span class="n"><a href="#t1254">1254</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'in/a/dir/both.two'</span><span class="op">,</span> <span class="str">'two.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1255" class="pln"><span class="n"><a href="#t1255">1255</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1256" class="run"><span class="n"><a href="#t1256">1256</a></span><span class="t">    <span class="key">def</span> <span class="nam">testAtFileWithBadArgCombo</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1257" class="mis show_mis"><span class="n"><a href="#t1257">1257</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1258" class="pln"><span class="n"><a href="#t1258">1258</a></span><span class="t">            <span class="str">'both.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1259" class="pln"><span class="n"><a href="#t1259">1259</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1260" class="pln"><span class="n"><a href="#t1260">1260</a></span><span class="t"><span class="str">                cog.outl("one: %s" % ('one' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1261" class="pln"><span class="n"><a href="#t1261">1261</a></span><span class="t"><span class="str">                cog.outl("two: %s" % ('two' in globals()))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1262" class="pln"><span class="n"><a href="#t1262">1262</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1263" class="pln"><span class="n"><a href="#t1263">1263</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1264" class="pln"><span class="n"><a href="#t1264">1264</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1265" class="pln"><span class="n"><a href="#t1265">1265</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1266" class="pln"><span class="n"><a href="#t1266">1266</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1267" class="pln"><span class="n"><a href="#t1267">1267</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1268" class="pln"><span class="n"><a href="#t1268">1268</a></span><span class="t"><span class="str">                both.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1269" class="pln"><span class="n"><a href="#t1269">1269</a></span><span class="t"><span class="str">                both.cog -d # This is bad: -r and -d</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1270" class="pln"><span class="n"><a href="#t1270">1270</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1271" class="pln"><span class="n"><a href="#t1271">1271</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1272" class="pln"><span class="n"><a href="#t1272">1272</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1273" class="mis show_mis"><span class="n"><a href="#t1273">1273</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1274" class="mis show_mis"><span class="n"><a href="#t1274">1274</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^Can't use -d with -r \(or you would delete all your source!\)$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1275" class="mis show_mis"><span class="n"><a href="#t1275">1275</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1276" class="pln"><span class="n"><a href="#t1276">1276</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1277" class="run"><span class="n"><a href="#t1277">1277</a></span><span class="t">    <span class="key">def</span> <span class="nam">testAtFileWithTrickyFilenames</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1278" class="mis show_mis"><span class="n"><a href="#t1278">1278</a></span><span class="t">        <span class="key">def</span> <span class="nam">fix_backslashes</span><span class="op">(</span><span class="nam">files_txt</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1279" class="pln"><span class="n"><a href="#t1279">1279</a></span><span class="t">            <span class="str">"""Make the contents of a files.txt sensitive to the platform."""</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1280" class="mis show_mis"><span class="n"><a href="#t1280">1280</a></span><span class="t">            <span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">platform</span> <span class="op">!=</span> <span class="str">"win32"</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1281" class="mis show_mis"><span class="n"><a href="#t1281">1281</a></span><span class="t">                <span class="nam">files_txt</span> <span class="op">=</span> <span class="nam">files_txt</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\\"</span><span class="op">,</span> <span class="str">"/"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1282" class="mis show_mis"><span class="n"><a href="#t1282">1282</a></span><span class="t">            <span class="key">return</span> <span class="nam">files_txt</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1283" class="pln"><span class="n"><a href="#t1283">1283</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1284" class="mis show_mis"><span class="n"><a href="#t1284">1284</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1285" class="pln"><span class="n"><a href="#t1285">1285</a></span><span class="t">            <span class="str">'one 1.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1286" class="pln"><span class="n"><a href="#t1286">1286</a></span><span class="t"><span class="str">                //[[[cog cog.outl("hello world") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1287" class="pln"><span class="n"><a href="#t1287">1287</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1288" class="pln"><span class="n"><a href="#t1288">1288</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1289" class="pln"><span class="n"><a href="#t1289">1289</a></span><span class="t">            <span class="str">'one.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1290" class="pln"><span class="n"><a href="#t1290">1290</a></span><span class="t"><span class="str">                //[[[cog cog.outl("hello world") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1291" class="pln"><span class="n"><a href="#t1291">1291</a></span><span class="t"><span class="str">                hello world //xxx</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1292" class="pln"><span class="n"><a href="#t1292">1292</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1293" class="pln"><span class="n"><a href="#t1293">1293</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1294" class="pln"><span class="n"><a href="#t1294">1294</a></span><span class="t">            <span class="str">'subdir'</span><span class="op">:</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1295" class="pln"><span class="n"><a href="#t1295">1295</a></span><span class="t">                <span class="str">'subback.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1296" class="pln"><span class="n"><a href="#t1296">1296</a></span><span class="t"><span class="str">                    //[[[cog cog.outl("down deep with backslashes") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1297" class="pln"><span class="n"><a href="#t1297">1297</a></span><span class="t"><span class="str">                    """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1298" class="pln"><span class="n"><a href="#t1298">1298</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1299" class="pln"><span class="n"><a href="#t1299">1299</a></span><span class="t">                <span class="str">'subfwd.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1300" class="pln"><span class="n"><a href="#t1300">1300</a></span><span class="t"><span class="str">                    //[[[cog cog.outl("down deep with slashes") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1301" class="pln"><span class="n"><a href="#t1301">1301</a></span><span class="t"><span class="str">                    """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1302" class="pln"><span class="n"><a href="#t1302">1302</a></span><span class="t">                <span class="op">}</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1303" class="pln"><span class="n"><a href="#t1303">1303</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1304" class="pln"><span class="n"><a href="#t1304">1304</a></span><span class="t">            <span class="str">'subback.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1305" class="pln"><span class="n"><a href="#t1305">1305</a></span><span class="t"><span class="str">                //[[[cog cog.outl("down deep with backslashes") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1306" class="pln"><span class="n"><a href="#t1306">1306</a></span><span class="t"><span class="str">                down deep with backslashes //yyy</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1307" class="pln"><span class="n"><a href="#t1307">1307</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1308" class="pln"><span class="n"><a href="#t1308">1308</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1309" class="pln"><span class="n"><a href="#t1309">1309</a></span><span class="t">            <span class="str">'subfwd.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1310" class="pln"><span class="n"><a href="#t1310">1310</a></span><span class="t"><span class="str">                //[[[cog cog.outl("down deep with slashes") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1311" class="pln"><span class="n"><a href="#t1311">1311</a></span><span class="t"><span class="str">                down deep with slashes //zzz</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1312" class="pln"><span class="n"><a href="#t1312">1312</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1313" class="pln"><span class="n"><a href="#t1313">1313</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1314" class="pln"><span class="n"><a href="#t1314">1314</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="nam">fix_backslashes</span><span class="op">(</span><span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1315" class="pln"><span class="n"><a href="#t1315">1315</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1316" class="pln"><span class="n"><a href="#t1316">1316</a></span><span class="t"><span class="str">                'one 1.cog' -s ' //xxx'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1317" class="pln"><span class="n"><a href="#t1317">1317</a></span><span class="t"><span class="str">                subdir\\subback.cog -s ' //yyy'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1318" class="pln"><span class="n"><a href="#t1318">1318</a></span><span class="t"><span class="str">                subdir/subfwd.cog -s ' //zzz'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1319" class="pln"><span class="n"><a href="#t1319">1319</a></span><span class="t"><span class="str">                """</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1320" class="pln"><span class="n"><a href="#t1320">1320</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1321" class="pln"><span class="n"><a href="#t1321">1321</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1322" class="mis show_mis"><span class="n"><a href="#t1322">1322</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1323" class="mis show_mis"><span class="n"><a href="#t1323">1323</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-z'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1324" class="mis show_mis"><span class="n"><a href="#t1324">1324</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'one 1.cog'</span><span class="op">,</span> <span class="str">'one.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1325" class="mis show_mis"><span class="n"><a href="#t1325">1325</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'subdir/subback.cog'</span><span class="op">,</span> <span class="str">'subback.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1326" class="mis show_mis"><span class="n"><a href="#t1326">1326</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'subdir/subfwd.cog'</span><span class="op">,</span> <span class="str">'subfwd.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1327" class="pln"><span class="n"><a href="#t1327">1327</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1328" class="run"><span class="n"><a href="#t1328">1328</a></span><span class="t">    <span class="key">def</span> <span class="nam">run_with_verbosity</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">verbosity</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1329" class="mis show_mis"><span class="n"><a href="#t1329">1329</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1330" class="pln"><span class="n"><a href="#t1330">1330</a></span><span class="t">            <span class="str">'unchanged.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1331" class="pln"><span class="n"><a href="#t1331">1331</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1332" class="pln"><span class="n"><a href="#t1332">1332</a></span><span class="t"><span class="str">                cog.outl("hello world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1333" class="pln"><span class="n"><a href="#t1333">1333</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1334" class="pln"><span class="n"><a href="#t1334">1334</a></span><span class="t"><span class="str">                hello world</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1335" class="pln"><span class="n"><a href="#t1335">1335</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1336" class="pln"><span class="n"><a href="#t1336">1336</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1337" class="pln"><span class="n"><a href="#t1337">1337</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1338" class="pln"><span class="n"><a href="#t1338">1338</a></span><span class="t">            <span class="str">'changed.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1339" class="pln"><span class="n"><a href="#t1339">1339</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1340" class="pln"><span class="n"><a href="#t1340">1340</a></span><span class="t"><span class="str">                cog.outl("goodbye cruel world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1341" class="pln"><span class="n"><a href="#t1341">1341</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1342" class="pln"><span class="n"><a href="#t1342">1342</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1343" class="pln"><span class="n"><a href="#t1343">1343</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1344" class="pln"><span class="n"><a href="#t1344">1344</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1345" class="pln"><span class="n"><a href="#t1345">1345</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1346" class="pln"><span class="n"><a href="#t1346">1346</a></span><span class="t"><span class="str">                unchanged.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1347" class="pln"><span class="n"><a href="#t1347">1347</a></span><span class="t"><span class="str">                changed.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1348" class="pln"><span class="n"><a href="#t1348">1348</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1349" class="pln"><span class="n"><a href="#t1349">1349</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1350" class="pln"><span class="n"><a href="#t1350">1350</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1351" class="mis show_mis"><span class="n"><a href="#t1351">1351</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1352" class="mis show_mis"><span class="n"><a href="#t1352">1352</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'--verbosity='</span><span class="op">+</span><span class="nam">verbosity</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1353" class="mis show_mis"><span class="n"><a href="#t1353">1353</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1354" class="mis show_mis"><span class="n"><a href="#t1354">1354</a></span><span class="t">        <span class="key">return</span> <span class="nam">output</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1355" class="pln"><span class="n"><a href="#t1355">1355</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1356" class="run"><span class="n"><a href="#t1356">1356</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_verbosity0</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1357" class="mis show_mis"><span class="n"><a href="#t1357">1357</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">run_with_verbosity</span><span class="op">(</span><span class="str">"0"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1358" class="mis show_mis"><span class="n"><a href="#t1358">1358</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1359" class="pln"><span class="n"><a href="#t1359">1359</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1360" class="run"><span class="n"><a href="#t1360">1360</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_verbosity1</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1361" class="mis show_mis"><span class="n"><a href="#t1361">1361</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">run_with_verbosity</span><span class="op">(</span><span class="str">"1"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1362" class="mis show_mis"><span class="n"><a href="#t1362">1362</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">"Cogging changed.cog  (changed)\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1363" class="pln"><span class="n"><a href="#t1363">1363</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1364" class="run"><span class="n"><a href="#t1364">1364</a></span><span class="t">    <span class="key">def</span> <span class="nam">test_verbosity2</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1365" class="mis show_mis"><span class="n"><a href="#t1365">1365</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">run_with_verbosity</span><span class="op">(</span><span class="str">"2"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1366" class="mis show_mis"><span class="n"><a href="#t1366">1366</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">"Cogging unchanged.cog\nCogging changed.cog  (changed)\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1367" class="pln"><span class="n"><a href="#t1367">1367</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1368" class="pln"><span class="n"><a href="#t1368">1368</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1369" class="run"><span class="n"><a href="#t1369">1369</a></span><span class="t"><span class="key">class</span> <span class="nam">CogTestLineEndings</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1370" class="pln"><span class="n"><a href="#t1370">1370</a></span><span class="t">    <span class="str">"""Tests for -U option (force LF line-endings in output)."""</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1371" class="pln"><span class="n"><a href="#t1371">1371</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1372" class="run"><span class="n"><a href="#t1372">1372</a></span><span class="t">    <span class="nam">lines_in</span> <span class="op">=</span> <span class="op">[</span><span class="str">'Some text.'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1373" class="pln"><span class="n"><a href="#t1373">1373</a></span><span class="t">                <span class="str">'//[[[cog'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1374" class="pln"><span class="n"><a href="#t1374">1374</a></span><span class="t">                <span class="str">'cog.outl("Cog text")'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1375" class="pln"><span class="n"><a href="#t1375">1375</a></span><span class="t">                <span class="str">'//]]]'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1376" class="pln"><span class="n"><a href="#t1376">1376</a></span><span class="t">                <span class="str">'gobbledegook.'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1377" class="pln"><span class="n"><a href="#t1377">1377</a></span><span class="t">                <span class="str">'//[[[end]]]'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1378" class="pln"><span class="n"><a href="#t1378">1378</a></span><span class="t">                <span class="str">'epilogue.'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1379" class="pln"><span class="n"><a href="#t1379">1379</a></span><span class="t">                <span class="str">''</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1380" class="pln"><span class="n"><a href="#t1380">1380</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1381" class="run"><span class="n"><a href="#t1381">1381</a></span><span class="t">    <span class="nam">lines_out</span> <span class="op">=</span> <span class="op">[</span><span class="str">'Some text.'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1382" class="pln"><span class="n"><a href="#t1382">1382</a></span><span class="t">                 <span class="str">'//[[[cog'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1383" class="pln"><span class="n"><a href="#t1383">1383</a></span><span class="t">                 <span class="str">'cog.outl("Cog text")'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1384" class="pln"><span class="n"><a href="#t1384">1384</a></span><span class="t">                 <span class="str">'//]]]'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1385" class="pln"><span class="n"><a href="#t1385">1385</a></span><span class="t">                 <span class="str">'Cog text'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1386" class="pln"><span class="n"><a href="#t1386">1386</a></span><span class="t">                 <span class="str">'//[[[end]]]'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1387" class="pln"><span class="n"><a href="#t1387">1387</a></span><span class="t">                 <span class="str">'epilogue.'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1388" class="pln"><span class="n"><a href="#t1388">1388</a></span><span class="t">                 <span class="str">''</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1389" class="pln"><span class="n"><a href="#t1389">1389</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1390" class="run"><span class="n"><a href="#t1390">1390</a></span><span class="t">    <span class="key">def</span> <span class="nam">testOutputNativeEol</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1391" class="mis show_mis"><span class="n"><a href="#t1391">1391</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="op">{</span><span class="str">'infile'</span><span class="op">:</span> <span class="str">'\n'</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_in</span><span class="op">)</span><span class="op">}</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1392" class="mis show_mis"><span class="n"><a href="#t1392">1392</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'outfile'</span><span class="op">,</span> <span class="str">'infile'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1393" class="mis show_mis"><span class="n"><a href="#t1393">1393</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFileContent</span><span class="op">(</span><span class="str">'outfile'</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">linesep</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_out</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1394" class="pln"><span class="n"><a href="#t1394">1394</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1395" class="run"><span class="n"><a href="#t1395">1395</a></span><span class="t">    <span class="key">def</span> <span class="nam">testOutputLfEol</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1396" class="mis show_mis"><span class="n"><a href="#t1396">1396</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="op">{</span><span class="str">'infile'</span><span class="op">:</span> <span class="str">'\n'</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_in</span><span class="op">)</span><span class="op">}</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1397" class="mis show_mis"><span class="n"><a href="#t1397">1397</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-U'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'outfile'</span><span class="op">,</span> <span class="str">'infile'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1398" class="mis show_mis"><span class="n"><a href="#t1398">1398</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFileContent</span><span class="op">(</span><span class="str">'outfile'</span><span class="op">,</span> <span class="str">'\n'</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_out</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1399" class="pln"><span class="n"><a href="#t1399">1399</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1400" class="run"><span class="n"><a href="#t1400">1400</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReplaceNativeEol</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1401" class="mis show_mis"><span class="n"><a href="#t1401">1401</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="op">{</span><span class="str">'test.cog'</span><span class="op">:</span> <span class="str">'\n'</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_in</span><span class="op">)</span><span class="op">}</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1402" class="mis show_mis"><span class="n"><a href="#t1402">1402</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1403" class="mis show_mis"><span class="n"><a href="#t1403">1403</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFileContent</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">linesep</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_out</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1404" class="pln"><span class="n"><a href="#t1404">1404</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1405" class="run"><span class="n"><a href="#t1405">1405</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReplaceLfEol</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1406" class="mis show_mis"><span class="n"><a href="#t1406">1406</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="op">{</span><span class="str">'test.cog'</span><span class="op">:</span> <span class="str">'\n'</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_in</span><span class="op">)</span><span class="op">}</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1407" class="mis show_mis"><span class="n"><a href="#t1407">1407</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-U'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1408" class="mis show_mis"><span class="n"><a href="#t1408">1408</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFileContent</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'\n'</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">lines_out</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1409" class="pln"><span class="n"><a href="#t1409">1409</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1410" class="pln"><span class="n"><a href="#t1410">1410</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1411" class="run"><span class="n"><a href="#t1411">1411</a></span><span class="t"><span class="key">class</span> <span class="nam">CogTestCharacterEncoding</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1412" class="pln"><span class="n"><a href="#t1412">1412</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1413" class="run"><span class="n"><a href="#t1413">1413</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSimple</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1414" class="mis show_mis"><span class="n"><a href="#t1414">1414</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1415" class="pln"><span class="n"><a href="#t1415">1415</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">b"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1416" class="pln"><span class="n"><a href="#t1416">1416</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1417" class="pln"><span class="n"><a href="#t1417">1417</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1418" class="pln"><span class="n"><a href="#t1418">1418</a></span><span class="t"><span class="str">                cog.outl("// Unicode: \xe1\x88\xb4 (U+1234)")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1419" class="pln"><span class="n"><a href="#t1419">1419</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1420" class="pln"><span class="n"><a href="#t1420">1420</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1421" class="pln"><span class="n"><a href="#t1421">1421</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1422" class="pln"><span class="n"><a href="#t1422">1422</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1423" class="pln"><span class="n"><a href="#t1423">1423</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">b"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1424" class="pln"><span class="n"><a href="#t1424">1424</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1425" class="pln"><span class="n"><a href="#t1425">1425</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1426" class="pln"><span class="n"><a href="#t1426">1426</a></span><span class="t"><span class="str">                cog.outl("// Unicode: \xe1\x88\xb4 (U+1234)")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1427" class="pln"><span class="n"><a href="#t1427">1427</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1428" class="pln"><span class="n"><a href="#t1428">1428</a></span><span class="t"><span class="str">                // Unicode: \xe1\x88\xb4 (U+1234)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1429" class="pln"><span class="n"><a href="#t1429">1429</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1430" class="pln"><span class="n"><a href="#t1430">1430</a></span><span class="t"><span class="str">                """</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">b"\n"</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">linesep</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1431" class="pln"><span class="n"><a href="#t1431">1431</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1432" class="pln"><span class="n"><a href="#t1432">1432</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1433" class="mis show_mis"><span class="n"><a href="#t1433">1433</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">bytes</span><span class="op">=</span><span class="key">True</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1434" class="mis show_mis"><span class="n"><a href="#t1434">1434</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1435" class="mis show_mis"><span class="n"><a href="#t1435">1435</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1436" class="mis show_mis"><span class="n"><a href="#t1436">1436</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1437" class="mis show_mis"><span class="n"><a href="#t1437">1437</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1438" class="pln"><span class="n"><a href="#t1438">1438</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1439" class="run"><span class="n"><a href="#t1439">1439</a></span><span class="t">    <span class="key">def</span> <span class="nam">testFileEncodingOption</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1440" class="mis show_mis"><span class="n"><a href="#t1440">1440</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1441" class="pln"><span class="n"><a href="#t1441">1441</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">b"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1442" class="pln"><span class="n"><a href="#t1442">1442</a></span><span class="t"><span class="str">                // \xca\xee\xe4\xe8\xf0\xe2\xea\xe0 Windows</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1443" class="pln"><span class="n"><a href="#t1443">1443</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1444" class="pln"><span class="n"><a href="#t1444">1444</a></span><span class="t"><span class="str">                cog.outl("\xd1\xfa\xe5\xf8\xfc \xe5\xf9\xb8 \xfd\xf2\xe8\xf5 \xec\xff\xe3\xea\xe8\xf5 \xf4\xf0\xe0\xed\xf6\xf3\xe7\xf1\xea\xe8\xf5 \xe1\xf3\xeb\xee\xea \xe4\xe0 \xe2\xfb\xef\xe5\xe9 \xf7\xe0\xfe")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1445" class="pln"><span class="n"><a href="#t1445">1445</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1446" class="pln"><span class="n"><a href="#t1446">1446</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1447" class="pln"><span class="n"><a href="#t1447">1447</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1448" class="pln"><span class="n"><a href="#t1448">1448</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1449" class="pln"><span class="n"><a href="#t1449">1449</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">b"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1450" class="pln"><span class="n"><a href="#t1450">1450</a></span><span class="t"><span class="str">                // \xca\xee\xe4\xe8\xf0\xe2\xea\xe0 Windows</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1451" class="pln"><span class="n"><a href="#t1451">1451</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1452" class="pln"><span class="n"><a href="#t1452">1452</a></span><span class="t"><span class="str">                cog.outl("\xd1\xfa\xe5\xf8\xfc \xe5\xf9\xb8 \xfd\xf2\xe8\xf5 \xec\xff\xe3\xea\xe8\xf5 \xf4\xf0\xe0\xed\xf6\xf3\xe7\xf1\xea\xe8\xf5 \xe1\xf3\xeb\xee\xea \xe4\xe0 \xe2\xfb\xef\xe5\xe9 \xf7\xe0\xfe")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1453" class="pln"><span class="n"><a href="#t1453">1453</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1454" class="pln"><span class="n"><a href="#t1454">1454</a></span><span class="t"><span class="str">                \xd1\xfa\xe5\xf8\xfc \xe5\xf9\xb8 \xfd\xf2\xe8\xf5 \xec\xff\xe3\xea\xe8\xf5 \xf4\xf0\xe0\xed\xf6\xf3\xe7\xf1\xea\xe8\xf5 \xe1\xf3\xeb\xee\xea \xe4\xe0 \xe2\xfb\xef\xe5\xe9 \xf7\xe0\xfe</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1455" class="pln"><span class="n"><a href="#t1455">1455</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1456" class="pln"><span class="n"><a href="#t1456">1456</a></span><span class="t"><span class="str">                """</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">b"\n"</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">linesep</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1457" class="pln"><span class="n"><a href="#t1457">1457</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1458" class="pln"><span class="n"><a href="#t1458">1458</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1459" class="mis show_mis"><span class="n"><a href="#t1459">1459</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">bytes</span><span class="op">=</span><span class="key">True</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1460" class="mis show_mis"><span class="n"><a href="#t1460">1460</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-n'</span><span class="op">,</span> <span class="str">'cp1251'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1461" class="mis show_mis"><span class="n"><a href="#t1461">1461</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1462" class="mis show_mis"><span class="n"><a href="#t1462">1462</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1463" class="mis show_mis"><span class="n"><a href="#t1463">1463</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1464" class="pln"><span class="n"><a href="#t1464">1464</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1465" class="pln"><span class="n"><a href="#t1465">1465</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1466" class="run"><span class="n"><a href="#t1466">1466</a></span><span class="t"><span class="key">class</span> <span class="nam">TestCaseWithImports</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1467" class="pln"><span class="n"><a href="#t1467">1467</a></span><span class="t">    <span class="str">""" When running tests which import modules, the sys.modules list</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1468" class="pln"><span class="n"><a href="#t1468">1468</a></span><span class="t"><span class="str">        leaks from one test to the next.  This test case class scrubs</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1469" class="pln"><span class="n"><a href="#t1469">1469</a></span><span class="t"><span class="str">        the list after each run to keep the tests isolated from each other.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1470" class="pln"><span class="n"><a href="#t1470">1470</a></span><span class="t"><span class="str">    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1471" class="pln"><span class="n"><a href="#t1471">1471</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1472" class="run"><span class="n"><a href="#t1472">1472</a></span><span class="t">    <span class="key">def</span> <span class="nam">setUp</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1473" class="mis show_mis"><span class="n"><a href="#t1473">1473</a></span><span class="t">        <span class="nam">super</span><span class="op">(</span><span class="nam">TestCaseWithImports</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">setUp</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1474" class="mis show_mis"><span class="n"><a href="#t1474">1474</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">sysmodulekeys</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">modules</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1475" class="pln"><span class="n"><a href="#t1475">1475</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1476" class="run"><span class="n"><a href="#t1476">1476</a></span><span class="t">    <span class="key">def</span> <span class="nam">tearDown</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1477" class="mis show_mis"><span class="n"><a href="#t1477">1477</a></span><span class="t">        <span class="nam">modstoscrub</span> <span class="op">=</span> <span class="op">[</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1478" class="pln"><span class="n"><a href="#t1478">1478</a></span><span class="t">            <span class="nam">modname</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1479" class="pln"><span class="n"><a href="#t1479">1479</a></span><span class="t">            <span class="key">for</span> <span class="nam">modname</span> <span class="key">in</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">modules</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1480" class="pln"><span class="n"><a href="#t1480">1480</a></span><span class="t">            <span class="key">if</span> <span class="nam">modname</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">sysmodulekeys</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1481" class="pln"><span class="n"><a href="#t1481">1481</a></span><span class="t">            <span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1482" class="mis show_mis"><span class="n"><a href="#t1482">1482</a></span><span class="t">        <span class="key">for</span> <span class="nam">modname</span> <span class="key">in</span> <span class="nam">modstoscrub</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1483" class="mis show_mis"><span class="n"><a href="#t1483">1483</a></span><span class="t">            <span class="key">del</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">modules</span><span class="op">[</span><span class="nam">modname</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1484" class="mis show_mis"><span class="n"><a href="#t1484">1484</a></span><span class="t">        <span class="nam">super</span><span class="op">(</span><span class="nam">TestCaseWithImports</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">tearDown</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1485" class="pln"><span class="n"><a href="#t1485">1485</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1486" class="pln"><span class="n"><a href="#t1486">1486</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1487" class="run"><span class="n"><a href="#t1487">1487</a></span><span class="t"><span class="key">class</span> <span class="nam">CogIncludeTests</span><span class="op">(</span><span class="nam">TestCaseWithImports</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1488" class="run"><span class="n"><a href="#t1488">1488</a></span><span class="t">    <span class="nam">dincludes</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1489" class="pln"><span class="n"><a href="#t1489">1489</a></span><span class="t">        <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1490" class="pln"><span class="n"><a href="#t1490">1490</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1491" class="pln"><span class="n"><a href="#t1491">1491</a></span><span class="t"><span class="str">                import mymodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1492" class="pln"><span class="n"><a href="#t1492">1492</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1493" class="pln"><span class="n"><a href="#t1493">1493</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1494" class="pln"><span class="n"><a href="#t1494">1494</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1495" class="pln"><span class="n"><a href="#t1495">1495</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1496" class="pln"><span class="n"><a href="#t1496">1496</a></span><span class="t">        <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1497" class="pln"><span class="n"><a href="#t1497">1497</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1498" class="pln"><span class="n"><a href="#t1498">1498</a></span><span class="t"><span class="str">                import mymodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1499" class="pln"><span class="n"><a href="#t1499">1499</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1500" class="pln"><span class="n"><a href="#t1500">1500</a></span><span class="t"><span class="str">            Hello from mymodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1501" class="pln"><span class="n"><a href="#t1501">1501</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1502" class="pln"><span class="n"><a href="#t1502">1502</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1503" class="pln"><span class="n"><a href="#t1503">1503</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1504" class="pln"><span class="n"><a href="#t1504">1504</a></span><span class="t">        <span class="str">'test2.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1505" class="pln"><span class="n"><a href="#t1505">1505</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1506" class="pln"><span class="n"><a href="#t1506">1506</a></span><span class="t"><span class="str">                import mymodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1507" class="pln"><span class="n"><a href="#t1507">1507</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1508" class="pln"><span class="n"><a href="#t1508">1508</a></span><span class="t"><span class="str">            Hello from mymodule in inc2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1509" class="pln"><span class="n"><a href="#t1509">1509</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1510" class="pln"><span class="n"><a href="#t1510">1510</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1511" class="pln"><span class="n"><a href="#t1511">1511</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1512" class="pln"><span class="n"><a href="#t1512">1512</a></span><span class="t">        <span class="str">'include'</span><span class="op">:</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1513" class="pln"><span class="n"><a href="#t1513">1513</a></span><span class="t">            <span class="str">'mymodule.py'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1514" class="pln"><span class="n"><a href="#t1514">1514</a></span><span class="t"><span class="str">                import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1515" class="pln"><span class="n"><a href="#t1515">1515</a></span><span class="t"><span class="str">                cog.outl("Hello from mymodule")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1516" class="pln"><span class="n"><a href="#t1516">1516</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1517" class="pln"><span class="n"><a href="#t1517">1517</a></span><span class="t">            <span class="op">}</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1518" class="pln"><span class="n"><a href="#t1518">1518</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1519" class="pln"><span class="n"><a href="#t1519">1519</a></span><span class="t">        <span class="str">'inc2'</span><span class="op">:</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1520" class="pln"><span class="n"><a href="#t1520">1520</a></span><span class="t">            <span class="str">'mymodule.py'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1521" class="pln"><span class="n"><a href="#t1521">1521</a></span><span class="t"><span class="str">                import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1522" class="pln"><span class="n"><a href="#t1522">1522</a></span><span class="t"><span class="str">                cog.outl("Hello from mymodule in inc2")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1523" class="pln"><span class="n"><a href="#t1523">1523</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1524" class="pln"><span class="n"><a href="#t1524">1524</a></span><span class="t">            <span class="op">}</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1525" class="pln"><span class="n"><a href="#t1525">1525</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1526" class="pln"><span class="n"><a href="#t1526">1526</a></span><span class="t">        <span class="str">'inc3'</span><span class="op">:</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1527" class="pln"><span class="n"><a href="#t1527">1527</a></span><span class="t">            <span class="str">'someothermodule.py'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1528" class="pln"><span class="n"><a href="#t1528">1528</a></span><span class="t"><span class="str">                import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1529" class="pln"><span class="n"><a href="#t1529">1529</a></span><span class="t"><span class="str">                cog.outl("This is some other module.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1530" class="pln"><span class="n"><a href="#t1530">1530</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1531" class="pln"><span class="n"><a href="#t1531">1531</a></span><span class="t">            <span class="op">}</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1532" class="pln"><span class="n"><a href="#t1532">1532</a></span><span class="t">        <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1533" class="pln"><span class="n"><a href="#t1533">1533</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1534" class="run"><span class="n"><a href="#t1534">1534</a></span><span class="t">    <span class="key">def</span> <span class="nam">testNeedIncludePath</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1535" class="pln"><span class="n"><a href="#t1535">1535</a></span><span class="t">        <span class="com"># Try it without the -I, to see that an ImportError happens.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1536" class="mis show_mis"><span class="n"><a href="#t1536">1536</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">dincludes</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1537" class="mis show_mis"><span class="n"><a href="#t1537">1537</a></span><span class="t">        <span class="nam">msg</span> <span class="op">=</span> <span class="str">"(ImportError|ModuleNotFoundError): No module named '?mymodule'?"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1538" class="mis show_mis"><span class="n"><a href="#t1538">1538</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUserException</span><span class="op">,</span> <span class="nam">msg</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1539" class="mis show_mis"><span class="n"><a href="#t1539">1539</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1540" class="pln"><span class="n"><a href="#t1540">1540</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1541" class="run"><span class="n"><a href="#t1541">1541</a></span><span class="t">    <span class="key">def</span> <span class="nam">testIncludePath</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1542" class="pln"><span class="n"><a href="#t1542">1542</a></span><span class="t">        <span class="com"># Test that -I adds include directories properly.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1543" class="mis show_mis"><span class="n"><a href="#t1543">1543</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">dincludes</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1544" class="mis show_mis"><span class="n"><a href="#t1544">1544</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'include'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1545" class="mis show_mis"><span class="n"><a href="#t1545">1545</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1546" class="pln"><span class="n"><a href="#t1546">1546</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1547" class="run"><span class="n"><a href="#t1547">1547</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTwoIncludePaths</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1548" class="pln"><span class="n"><a href="#t1548">1548</a></span><span class="t">        <span class="com"># Test that two -I's add include directories properly.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1549" class="mis show_mis"><span class="n"><a href="#t1549">1549</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">dincludes</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1550" class="mis show_mis"><span class="n"><a href="#t1550">1550</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'include'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'inc2'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1551" class="mis show_mis"><span class="n"><a href="#t1551">1551</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1552" class="pln"><span class="n"><a href="#t1552">1552</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1553" class="run"><span class="n"><a href="#t1553">1553</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTwoIncludePaths2</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1554" class="pln"><span class="n"><a href="#t1554">1554</a></span><span class="t">        <span class="com"># Test that two -I's add include directories properly.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1555" class="mis show_mis"><span class="n"><a href="#t1555">1555</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">dincludes</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1556" class="mis show_mis"><span class="n"><a href="#t1556">1556</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'inc2'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'include'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1557" class="mis show_mis"><span class="n"><a href="#t1557">1557</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test2.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1558" class="pln"><span class="n"><a href="#t1558">1558</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1559" class="run"><span class="n"><a href="#t1559">1559</a></span><span class="t">    <span class="key">def</span> <span class="nam">testUselessIncludePath</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1560" class="pln"><span class="n"><a href="#t1560">1560</a></span><span class="t">        <span class="com"># Test that the search will continue past the first directory.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1561" class="mis show_mis"><span class="n"><a href="#t1561">1561</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">dincludes</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1562" class="mis show_mis"><span class="n"><a href="#t1562">1562</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'inc3'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'include'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1563" class="mis show_mis"><span class="n"><a href="#t1563">1563</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1564" class="pln"><span class="n"><a href="#t1564">1564</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1565" class="run"><span class="n"><a href="#t1565">1565</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSysPathIsUnchanged</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1566" class="mis show_mis"><span class="n"><a href="#t1566">1566</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1567" class="pln"><span class="n"><a href="#t1567">1567</a></span><span class="t">            <span class="str">'bad.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1568" class="pln"><span class="n"><a href="#t1568">1568</a></span><span class="t"><span class="str">                //[[[cog cog.error("Oh no!") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1569" class="pln"><span class="n"><a href="#t1569">1569</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1570" class="pln"><span class="n"><a href="#t1570">1570</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1571" class="pln"><span class="n"><a href="#t1571">1571</a></span><span class="t">            <span class="str">'good.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1572" class="pln"><span class="n"><a href="#t1572">1572</a></span><span class="t"><span class="str">                //[[[cog cog.outl("Oh yes!") ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1573" class="pln"><span class="n"><a href="#t1573">1573</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1574" class="pln"><span class="n"><a href="#t1574">1574</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1575" class="pln"><span class="n"><a href="#t1575">1575</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1576" class="pln"><span class="n"><a href="#t1576">1576</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1577" class="mis show_mis"><span class="n"><a href="#t1577">1577</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1578" class="pln"><span class="n"><a href="#t1578">1578</a></span><span class="t">        <span class="com"># Is it unchanged just by creating a cog engine?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1579" class="mis show_mis"><span class="n"><a href="#t1579">1579</a></span><span class="t">        <span class="nam">oldsyspath</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">[</span><span class="op">:</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1580" class="mis show_mis"><span class="n"><a href="#t1580">1580</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1581" class="mis show_mis"><span class="n"><a href="#t1581">1581</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1582" class="pln"><span class="n"><a href="#t1582">1582</a></span><span class="t">        <span class="com"># Is it unchanged for a successful run?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1583" class="mis show_mis"><span class="n"><a href="#t1583">1583</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1584" class="mis show_mis"><span class="n"><a href="#t1584">1584</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'good.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1585" class="mis show_mis"><span class="n"><a href="#t1585">1585</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1586" class="pln"><span class="n"><a href="#t1586">1586</a></span><span class="t">        <span class="com"># Is it unchanged for a successful run with includes?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1587" class="mis show_mis"><span class="n"><a href="#t1587">1587</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1588" class="mis show_mis"><span class="n"><a href="#t1588">1588</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'xyzzy'</span><span class="op">,</span> <span class="str">'good.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1589" class="mis show_mis"><span class="n"><a href="#t1589">1589</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1590" class="pln"><span class="n"><a href="#t1590">1590</a></span><span class="t">        <span class="com"># Is it unchanged for a successful run with two includes?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1591" class="mis show_mis"><span class="n"><a href="#t1591">1591</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1592" class="mis show_mis"><span class="n"><a href="#t1592">1592</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'xyzzy'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'quux'</span><span class="op">,</span> <span class="str">'good.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1593" class="mis show_mis"><span class="n"><a href="#t1593">1593</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1594" class="pln"><span class="n"><a href="#t1594">1594</a></span><span class="t">        <span class="com"># Is it unchanged for a failed run?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1595" class="mis show_mis"><span class="n"><a href="#t1595">1595</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1596" class="mis show_mis"><span class="n"><a href="#t1596">1596</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">r"^Oh no!$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1597" class="mis show_mis"><span class="n"><a href="#t1597">1597</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'bad.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1598" class="mis show_mis"><span class="n"><a href="#t1598">1598</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1599" class="pln"><span class="n"><a href="#t1599">1599</a></span><span class="t">        <span class="com"># Is it unchanged for a failed run with includes?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1600" class="mis show_mis"><span class="n"><a href="#t1600">1600</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1601" class="mis show_mis"><span class="n"><a href="#t1601">1601</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">r"^Oh no!$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1602" class="mis show_mis"><span class="n"><a href="#t1602">1602</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'xyzzy'</span><span class="op">,</span> <span class="str">'bad.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1603" class="mis show_mis"><span class="n"><a href="#t1603">1603</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1604" class="pln"><span class="n"><a href="#t1604">1604</a></span><span class="t">        <span class="com"># Is it unchanged for a failed run with two includes?</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1605" class="mis show_mis"><span class="n"><a href="#t1605">1605</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1606" class="mis show_mis"><span class="n"><a href="#t1606">1606</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">r"^Oh no!$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1607" class="mis show_mis"><span class="n"><a href="#t1607">1607</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'xyzzy'</span><span class="op">,</span> <span class="str">'-I'</span><span class="op">,</span> <span class="str">'quux'</span><span class="op">,</span> <span class="str">'bad.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1608" class="mis show_mis"><span class="n"><a href="#t1608">1608</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">oldsyspath</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1609" class="pln"><span class="n"><a href="#t1609">1609</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1610" class="run"><span class="n"><a href="#t1610">1610</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSubDirectories</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1611" class="pln"><span class="n"><a href="#t1611">1611</a></span><span class="t">        <span class="com"># Test that relative paths on the command line work, with includes.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1612" class="pln"><span class="n"><a href="#t1612">1612</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1613" class="mis show_mis"><span class="n"><a href="#t1613">1613</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1614" class="pln"><span class="n"><a href="#t1614">1614</a></span><span class="t">            <span class="str">'code'</span><span class="op">:</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1615" class="pln"><span class="n"><a href="#t1615">1615</a></span><span class="t">                <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1616" class="pln"><span class="n"><a href="#t1616">1616</a></span><span class="t"><span class="str">                    //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1617" class="pln"><span class="n"><a href="#t1617">1617</a></span><span class="t"><span class="str">                        import mysubmodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1618" class="pln"><span class="n"><a href="#t1618">1618</a></span><span class="t"><span class="str">                    //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1619" class="pln"><span class="n"><a href="#t1619">1619</a></span><span class="t"><span class="str">                    //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1620" class="pln"><span class="n"><a href="#t1620">1620</a></span><span class="t"><span class="str">                    """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1621" class="pln"><span class="n"><a href="#t1621">1621</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1622" class="pln"><span class="n"><a href="#t1622">1622</a></span><span class="t">                <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1623" class="pln"><span class="n"><a href="#t1623">1623</a></span><span class="t"><span class="str">                    //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1624" class="pln"><span class="n"><a href="#t1624">1624</a></span><span class="t"><span class="str">                        import mysubmodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1625" class="pln"><span class="n"><a href="#t1625">1625</a></span><span class="t"><span class="str">                    //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1626" class="pln"><span class="n"><a href="#t1626">1626</a></span><span class="t"><span class="str">                    Hello from mysubmodule</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1627" class="pln"><span class="n"><a href="#t1627">1627</a></span><span class="t"><span class="str">                    //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1628" class="pln"><span class="n"><a href="#t1628">1628</a></span><span class="t"><span class="str">                    """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1629" class="pln"><span class="n"><a href="#t1629">1629</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1630" class="pln"><span class="n"><a href="#t1630">1630</a></span><span class="t">                <span class="str">'mysubmodule.py'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1631" class="pln"><span class="n"><a href="#t1631">1631</a></span><span class="t"><span class="str">                    import cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1632" class="pln"><span class="n"><a href="#t1632">1632</a></span><span class="t"><span class="str">                    cog.outl("Hello from mysubmodule")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1633" class="pln"><span class="n"><a href="#t1633">1633</a></span><span class="t"><span class="str">                    """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1634" class="pln"><span class="n"><a href="#t1634">1634</a></span><span class="t">                <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1635" class="pln"><span class="n"><a href="#t1635">1635</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1636" class="pln"><span class="n"><a href="#t1636">1636</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1637" class="mis show_mis"><span class="n"><a href="#t1637">1637</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1638" class="pln"><span class="n"><a href="#t1638">1638</a></span><span class="t">        <span class="com"># We should be able to invoke cog without the -I switch, and it will</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1639" class="pln"><span class="n"><a href="#t1639">1639</a></span><span class="t">        <span class="com"># auto-include the current directory</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1640" class="mis show_mis"><span class="n"><a href="#t1640">1640</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'code/test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1641" class="mis show_mis"><span class="n"><a href="#t1641">1641</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'code/test.cog'</span><span class="op">,</span> <span class="str">'code/test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1642" class="pln"><span class="n"><a href="#t1642">1642</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1643" class="pln"><span class="n"><a href="#t1643">1643</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1644" class="run"><span class="n"><a href="#t1644">1644</a></span><span class="t"><span class="key">class</span> <span class="nam">CogTestsInFiles</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1645" class="pln"><span class="n"><a href="#t1645">1645</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1646" class="run"><span class="n"><a href="#t1646">1646</a></span><span class="t">    <span class="key">def</span> <span class="nam">testWarnIfNoCogCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1647" class="pln"><span class="n"><a href="#t1647">1647</a></span><span class="t">        <span class="com"># Test that the -e switch warns if there is no Cog code.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1648" class="mis show_mis"><span class="n"><a href="#t1648">1648</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1649" class="pln"><span class="n"><a href="#t1649">1649</a></span><span class="t">            <span class="str">'with.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1650" class="pln"><span class="n"><a href="#t1650">1650</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1651" class="pln"><span class="n"><a href="#t1651">1651</a></span><span class="t"><span class="str">                cog.outl("hello world")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1652" class="pln"><span class="n"><a href="#t1652">1652</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1653" class="pln"><span class="n"><a href="#t1653">1653</a></span><span class="t"><span class="str">                hello world</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1654" class="pln"><span class="n"><a href="#t1654">1654</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1655" class="pln"><span class="n"><a href="#t1655">1655</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1656" class="pln"><span class="n"><a href="#t1656">1656</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1657" class="pln"><span class="n"><a href="#t1657">1657</a></span><span class="t">            <span class="str">'without.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1658" class="pln"><span class="n"><a href="#t1658">1658</a></span><span class="t"><span class="str">                There's no cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1659" class="pln"><span class="n"><a href="#t1659">1659</a></span><span class="t"><span class="str">                code in this file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1660" class="pln"><span class="n"><a href="#t1660">1660</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1661" class="pln"><span class="n"><a href="#t1661">1661</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1662" class="pln"><span class="n"><a href="#t1662">1662</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1663" class="mis show_mis"><span class="n"><a href="#t1663">1663</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1664" class="mis show_mis"><span class="n"><a href="#t1664">1664</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-e'</span><span class="op">,</span> <span class="str">'with.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1665" class="mis show_mis"><span class="n"><a href="#t1665">1665</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1666" class="mis show_mis"><span class="n"><a href="#t1666">1666</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertNotIn</span><span class="op">(</span><span class="str">"Warning"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1667" class="mis show_mis"><span class="n"><a href="#t1667">1667</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1668" class="mis show_mis"><span class="n"><a href="#t1668">1668</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-e'</span><span class="op">,</span> <span class="str">'without.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1669" class="mis show_mis"><span class="n"><a href="#t1669">1669</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1670" class="mis show_mis"><span class="n"><a href="#t1670">1670</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"Warning: no cog code found in without.cog"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1671" class="mis show_mis"><span class="n"><a href="#t1671">1671</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1672" class="mis show_mis"><span class="n"><a href="#t1672">1672</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'without.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1673" class="mis show_mis"><span class="n"><a href="#t1673">1673</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1674" class="mis show_mis"><span class="n"><a href="#t1674">1674</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertNotIn</span><span class="op">(</span><span class="str">"Warning"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1675" class="pln"><span class="n"><a href="#t1675">1675</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1676" class="run"><span class="n"><a href="#t1676">1676</a></span><span class="t">    <span class="key">def</span> <span class="nam">testFileNameProps</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1677" class="mis show_mis"><span class="n"><a href="#t1677">1677</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1678" class="pln"><span class="n"><a href="#t1678">1678</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1679" class="pln"><span class="n"><a href="#t1679">1679</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1680" class="pln"><span class="n"><a href="#t1680">1680</a></span><span class="t"><span class="str">                cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1681" class="pln"><span class="n"><a href="#t1681">1681</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1682" class="pln"><span class="n"><a href="#t1682">1682</a></span><span class="t"><span class="str">                this is cog1.txt in, cog1.txt out</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1683" class="pln"><span class="n"><a href="#t1683">1683</a></span><span class="t"><span class="str">                [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1684" class="pln"><span class="n"><a href="#t1684">1684</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1685" class="pln"><span class="n"><a href="#t1685">1685</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1686" class="pln"><span class="n"><a href="#t1686">1686</a></span><span class="t">            <span class="str">'cog1.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1687" class="pln"><span class="n"><a href="#t1687">1687</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1688" class="pln"><span class="n"><a href="#t1688">1688</a></span><span class="t"><span class="str">                cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1689" class="pln"><span class="n"><a href="#t1689">1689</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1690" class="pln"><span class="n"><a href="#t1690">1690</a></span><span class="t"><span class="str">                This is cog1.txt in, cog1.txt out</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1691" class="pln"><span class="n"><a href="#t1691">1691</a></span><span class="t"><span class="str">                [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1692" class="pln"><span class="n"><a href="#t1692">1692</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1693" class="pln"><span class="n"><a href="#t1693">1693</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1694" class="pln"><span class="n"><a href="#t1694">1694</a></span><span class="t">            <span class="str">'cog1out.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1695" class="pln"><span class="n"><a href="#t1695">1695</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1696" class="pln"><span class="n"><a href="#t1696">1696</a></span><span class="t"><span class="str">                cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1697" class="pln"><span class="n"><a href="#t1697">1697</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1698" class="pln"><span class="n"><a href="#t1698">1698</a></span><span class="t"><span class="str">                This is cog1.txt in, cog1out.txt out</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1699" class="pln"><span class="n"><a href="#t1699">1699</a></span><span class="t"><span class="str">                [[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1700" class="pln"><span class="n"><a href="#t1700">1700</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1701" class="pln"><span class="n"><a href="#t1701">1701</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1702" class="pln"><span class="n"><a href="#t1702">1702</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1703" class="mis show_mis"><span class="n"><a href="#t1703">1703</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1704" class="mis show_mis"><span class="n"><a href="#t1704">1704</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1705" class="mis show_mis"><span class="n"><a href="#t1705">1705</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1706" class="mis show_mis"><span class="n"><a href="#t1706">1706</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1707" class="mis show_mis"><span class="n"><a href="#t1707">1707</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'cog1out.txt'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1708" class="mis show_mis"><span class="n"><a href="#t1708">1708</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1out.txt'</span><span class="op">,</span> <span class="str">'cog1out.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1709" class="pln"><span class="n"><a href="#t1709">1709</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1710" class="run"><span class="n"><a href="#t1710">1710</a></span><span class="t">    <span class="key">def</span> <span class="nam">testGlobalsDontCrossFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1711" class="pln"><span class="n"><a href="#t1711">1711</a></span><span class="t">        <span class="com"># Make sure that global values don't get shared between files.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1712" class="mis show_mis"><span class="n"><a href="#t1712">1712</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1713" class="pln"><span class="n"><a href="#t1713">1713</a></span><span class="t">            <span class="str">'one.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1714" class="pln"><span class="n"><a href="#t1714">1714</a></span><span class="t"><span class="str">                //[[[cog s = "This was set in one.cog" ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1715" class="pln"><span class="n"><a href="#t1715">1715</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1716" class="pln"><span class="n"><a href="#t1716">1716</a></span><span class="t"><span class="str">                //[[[cog cog.outl(s) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1717" class="pln"><span class="n"><a href="#t1717">1717</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1718" class="pln"><span class="n"><a href="#t1718">1718</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1719" class="pln"><span class="n"><a href="#t1719">1719</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1720" class="pln"><span class="n"><a href="#t1720">1720</a></span><span class="t">            <span class="str">'one.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1721" class="pln"><span class="n"><a href="#t1721">1721</a></span><span class="t"><span class="str">                //[[[cog s = "This was set in one.cog" ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1722" class="pln"><span class="n"><a href="#t1722">1722</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1723" class="pln"><span class="n"><a href="#t1723">1723</a></span><span class="t"><span class="str">                //[[[cog cog.outl(s) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1724" class="pln"><span class="n"><a href="#t1724">1724</a></span><span class="t"><span class="str">                This was set in one.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1725" class="pln"><span class="n"><a href="#t1725">1725</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1726" class="pln"><span class="n"><a href="#t1726">1726</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1727" class="pln"><span class="n"><a href="#t1727">1727</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1728" class="pln"><span class="n"><a href="#t1728">1728</a></span><span class="t">            <span class="str">'two.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1729" class="pln"><span class="n"><a href="#t1729">1729</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1730" class="pln"><span class="n"><a href="#t1730">1730</a></span><span class="t"><span class="str">                try:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1731" class="pln"><span class="n"><a href="#t1731">1731</a></span><span class="t"><span class="str">                    cog.outl(s)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1732" class="pln"><span class="n"><a href="#t1732">1732</a></span><span class="t"><span class="str">                except NameError:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1733" class="pln"><span class="n"><a href="#t1733">1733</a></span><span class="t"><span class="str">                    cog.outl("s isn't set!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1734" class="pln"><span class="n"><a href="#t1734">1734</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1735" class="pln"><span class="n"><a href="#t1735">1735</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1736" class="pln"><span class="n"><a href="#t1736">1736</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1737" class="pln"><span class="n"><a href="#t1737">1737</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1738" class="pln"><span class="n"><a href="#t1738">1738</a></span><span class="t">            <span class="str">'two.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1739" class="pln"><span class="n"><a href="#t1739">1739</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1740" class="pln"><span class="n"><a href="#t1740">1740</a></span><span class="t"><span class="str">                try:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1741" class="pln"><span class="n"><a href="#t1741">1741</a></span><span class="t"><span class="str">                    cog.outl(s)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1742" class="pln"><span class="n"><a href="#t1742">1742</a></span><span class="t"><span class="str">                except NameError:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1743" class="pln"><span class="n"><a href="#t1743">1743</a></span><span class="t"><span class="str">                    cog.outl("s isn't set!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1744" class="pln"><span class="n"><a href="#t1744">1744</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1745" class="pln"><span class="n"><a href="#t1745">1745</a></span><span class="t"><span class="str">                s isn't set!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1746" class="pln"><span class="n"><a href="#t1746">1746</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1747" class="pln"><span class="n"><a href="#t1747">1747</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1748" class="pln"><span class="n"><a href="#t1748">1748</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1749" class="pln"><span class="n"><a href="#t1749">1749</a></span><span class="t">            <span class="str">'cogfiles.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1750" class="pln"><span class="n"><a href="#t1750">1750</a></span><span class="t"><span class="str">                # Please run cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1751" class="pln"><span class="n"><a href="#t1751">1751</a></span><span class="t"><span class="str">                one.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1752" class="pln"><span class="n"><a href="#t1752">1752</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1753" class="pln"><span class="n"><a href="#t1753">1753</a></span><span class="t"><span class="str">                two.cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1754" class="pln"><span class="n"><a href="#t1754">1754</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1755" class="pln"><span class="n"><a href="#t1755">1755</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1756" class="pln"><span class="n"><a href="#t1756">1756</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1757" class="mis show_mis"><span class="n"><a href="#t1757">1757</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1758" class="mis show_mis"><span class="n"><a href="#t1758">1758</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'@cogfiles.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1759" class="mis show_mis"><span class="n"><a href="#t1759">1759</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'one.cog'</span><span class="op">,</span> <span class="str">'one.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1760" class="mis show_mis"><span class="n"><a href="#t1760">1760</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'two.cog'</span><span class="op">,</span> <span class="str">'two.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1761" class="mis show_mis"><span class="n"><a href="#t1761">1761</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1762" class="mis show_mis"><span class="n"><a href="#t1762">1762</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"(changed)"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1763" class="pln"><span class="n"><a href="#t1763">1763</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1764" class="run"><span class="n"><a href="#t1764">1764</a></span><span class="t">    <span class="key">def</span> <span class="nam">testRemoveGeneratedOutput</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1765" class="mis show_mis"><span class="n"><a href="#t1765">1765</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1766" class="pln"><span class="n"><a href="#t1766">1766</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1767" class="pln"><span class="n"><a href="#t1767">1767</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1768" class="pln"><span class="n"><a href="#t1768">1768</a></span><span class="t"><span class="str">                cog.outl("This line was generated.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1769" class="pln"><span class="n"><a href="#t1769">1769</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1770" class="pln"><span class="n"><a href="#t1770">1770</a></span><span class="t"><span class="str">                This line was generated.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1771" class="pln"><span class="n"><a href="#t1771">1771</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1772" class="pln"><span class="n"><a href="#t1772">1772</a></span><span class="t"><span class="str">                This line was not.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1773" class="pln"><span class="n"><a href="#t1773">1773</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1774" class="pln"><span class="n"><a href="#t1774">1774</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1775" class="pln"><span class="n"><a href="#t1775">1775</a></span><span class="t">            <span class="str">'cog1.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1776" class="pln"><span class="n"><a href="#t1776">1776</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1777" class="pln"><span class="n"><a href="#t1777">1777</a></span><span class="t"><span class="str">                cog.outl("This line was generated.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1778" class="pln"><span class="n"><a href="#t1778">1778</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1779" class="pln"><span class="n"><a href="#t1779">1779</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1780" class="pln"><span class="n"><a href="#t1780">1780</a></span><span class="t"><span class="str">                This line was not.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1781" class="pln"><span class="n"><a href="#t1781">1781</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1782" class="pln"><span class="n"><a href="#t1782">1782</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1783" class="pln"><span class="n"><a href="#t1783">1783</a></span><span class="t">            <span class="str">'cog1.out2'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1784" class="pln"><span class="n"><a href="#t1784">1784</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1785" class="pln"><span class="n"><a href="#t1785">1785</a></span><span class="t"><span class="str">                cog.outl("This line was generated.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1786" class="pln"><span class="n"><a href="#t1786">1786</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1787" class="pln"><span class="n"><a href="#t1787">1787</a></span><span class="t"><span class="str">                This line was generated.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1788" class="pln"><span class="n"><a href="#t1788">1788</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1789" class="pln"><span class="n"><a href="#t1789">1789</a></span><span class="t"><span class="str">                This line was not.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1790" class="pln"><span class="n"><a href="#t1790">1790</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1791" class="pln"><span class="n"><a href="#t1791">1791</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1792" class="pln"><span class="n"><a href="#t1792">1792</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1793" class="mis show_mis"><span class="n"><a href="#t1793">1793</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1794" class="pln"><span class="n"><a href="#t1794">1794</a></span><span class="t">        <span class="com"># Remove generated output.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1795" class="mis show_mis"><span class="n"><a href="#t1795">1795</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-x'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1796" class="mis show_mis"><span class="n"><a href="#t1796">1796</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1797" class="mis show_mis"><span class="n"><a href="#t1797">1797</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1798" class="pln"><span class="n"><a href="#t1798">1798</a></span><span class="t">        <span class="com"># Regenerate the generated output.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1799" class="mis show_mis"><span class="n"><a href="#t1799">1799</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1800" class="mis show_mis"><span class="n"><a href="#t1800">1800</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out2'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1801" class="mis show_mis"><span class="n"><a href="#t1801">1801</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">newCog</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1802" class="pln"><span class="n"><a href="#t1802">1802</a></span><span class="t">        <span class="com"># Remove the generated output again.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1803" class="mis show_mis"><span class="n"><a href="#t1803">1803</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-x'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1804" class="mis show_mis"><span class="n"><a href="#t1804">1804</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1805" class="pln"><span class="n"><a href="#t1805">1805</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1806" class="run"><span class="n"><a href="#t1806">1806</a></span><span class="t">    <span class="key">def</span> <span class="nam">testMsgCall</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1807" class="mis show_mis"><span class="n"><a href="#t1807">1807</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1808" class="pln"><span class="n"><a href="#t1808">1808</a></span><span class="t"><span class="str">            #[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1809" class="pln"><span class="n"><a href="#t1809">1809</a></span><span class="t"><span class="str">                cog.msg("Hello there!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1810" class="pln"><span class="n"><a href="#t1810">1810</a></span><span class="t"><span class="str">            #]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1811" class="pln"><span class="n"><a href="#t1811">1811</a></span><span class="t"><span class="str">            #[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1812" class="pln"><span class="n"><a href="#t1812">1812</a></span><span class="t"><span class="str">            """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1813" class="mis show_mis"><span class="n"><a href="#t1813">1813</a></span><span class="t">        <span class="nam">infile</span> <span class="op">=</span> <span class="nam">reindentBlock</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1814" class="mis show_mis"><span class="n"><a href="#t1814">1814</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">processString</span><span class="op">(</span><span class="nam">infile</span><span class="op">)</span><span class="op">,</span> <span class="nam">infile</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1815" class="mis show_mis"><span class="n"><a href="#t1815">1815</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1816" class="mis show_mis"><span class="n"><a href="#t1816">1816</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">"Message: Hello there!\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1817" class="pln"><span class="n"><a href="#t1817">1817</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1818" class="run"><span class="n"><a href="#t1818">1818</a></span><span class="t">    <span class="key">def</span> <span class="nam">testErrorMessageHasNoTraceback</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1819" class="pln"><span class="n"><a href="#t1819">1819</a></span><span class="t">        <span class="com"># Test that a Cog error is printed to stderr with no traceback.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1820" class="pln"><span class="n"><a href="#t1820">1820</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1821" class="mis show_mis"><span class="n"><a href="#t1821">1821</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1822" class="pln"><span class="n"><a href="#t1822">1822</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1823" class="pln"><span class="n"><a href="#t1823">1823</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1824" class="pln"><span class="n"><a href="#t1824">1824</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1825" class="pln"><span class="n"><a href="#t1825">1825</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1826" class="pln"><span class="n"><a href="#t1826">1826</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1827" class="pln"><span class="n"><a href="#t1827">1827</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1828" class="pln"><span class="n"><a href="#t1828">1828</a></span><span class="t"><span class="str">                Xhis line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1829" class="pln"><span class="n"><a href="#t1829">1829</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1830" class="pln"><span class="n"><a href="#t1830">1830</a></span><span class="t"><span class="str">                blah blah.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1831" class="pln"><span class="n"><a href="#t1831">1831</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1832" class="pln"><span class="n"><a href="#t1832">1832</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1833" class="pln"><span class="n"><a href="#t1833">1833</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1834" class="pln"><span class="n"><a href="#t1834">1834</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1835" class="mis show_mis"><span class="n"><a href="#t1835">1835</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1836" class="mis show_mis"><span class="n"><a href="#t1836">1836</a></span><span class="t">        <span class="nam">stderr</span> <span class="op">=</span> <span class="nam">StringIO</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1837" class="mis show_mis"><span class="n"><a href="#t1837">1837</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">setOutput</span><span class="op">(</span><span class="nam">stderr</span><span class="op">=</span><span class="nam">stderr</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1838" class="mis show_mis"><span class="n"><a href="#t1838">1838</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">"cog1.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1839" class="mis show_mis"><span class="n"><a href="#t1839">1839</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">"Cogging cog1.txt\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1840" class="mis show_mis"><span class="n"><a href="#t1840">1840</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">stderr</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">"cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1841" class="pln"><span class="n"><a href="#t1841">1841</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1842" class="run"><span class="n"><a href="#t1842">1842</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDashD</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1843" class="mis show_mis"><span class="n"><a href="#t1843">1843</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1844" class="pln"><span class="n"><a href="#t1844">1844</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1845" class="pln"><span class="n"><a href="#t1845">1845</a></span><span class="t"><span class="str">                --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1846" class="pln"><span class="n"><a href="#t1846">1846</a></span><span class="t"><span class="str">                --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1847" class="pln"><span class="n"><a href="#t1847">1847</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1848" class="pln"><span class="n"><a href="#t1848">1848</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1849" class="pln"><span class="n"><a href="#t1849">1849</a></span><span class="t">            <span class="str">'test.kablooey'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1850" class="pln"><span class="n"><a href="#t1850">1850</a></span><span class="t"><span class="str">                --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1851" class="pln"><span class="n"><a href="#t1851">1851</a></span><span class="t"><span class="str">                Defined fooey as kablooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1852" class="pln"><span class="n"><a href="#t1852">1852</a></span><span class="t"><span class="str">                --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1853" class="pln"><span class="n"><a href="#t1853">1853</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1854" class="pln"><span class="n"><a href="#t1854">1854</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1855" class="pln"><span class="n"><a href="#t1855">1855</a></span><span class="t">            <span class="str">'test.einstein'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1856" class="pln"><span class="n"><a href="#t1856">1856</a></span><span class="t"><span class="str">                --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1857" class="pln"><span class="n"><a href="#t1857">1857</a></span><span class="t"><span class="str">                Defined fooey as e=mc2</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1858" class="pln"><span class="n"><a href="#t1858">1858</a></span><span class="t"><span class="str">                --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1859" class="pln"><span class="n"><a href="#t1859">1859</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1860" class="pln"><span class="n"><a href="#t1860">1860</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1861" class="pln"><span class="n"><a href="#t1861">1861</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1862" class="mis show_mis"><span class="n"><a href="#t1862">1862</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1863" class="mis show_mis"><span class="n"><a href="#t1863">1863</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-D'</span><span class="op">,</span> <span class="str">'fooey=kablooey'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1864" class="mis show_mis"><span class="n"><a href="#t1864">1864</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.kablooey'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1865" class="mis show_mis"><span class="n"><a href="#t1865">1865</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1866" class="mis show_mis"><span class="n"><a href="#t1866">1866</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-Dfooey=kablooey'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1867" class="mis show_mis"><span class="n"><a href="#t1867">1867</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.kablooey'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1868" class="mis show_mis"><span class="n"><a href="#t1868">1868</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1869" class="mis show_mis"><span class="n"><a href="#t1869">1869</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-Dfooey=e=mc2'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1870" class="mis show_mis"><span class="n"><a href="#t1870">1870</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.einstein'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1871" class="mis show_mis"><span class="n"><a href="#t1871">1871</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1872" class="mis show_mis"><span class="n"><a href="#t1872">1872</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-Dbar=quux'</span><span class="op">,</span> <span class="str">'-Dfooey=kablooey'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1873" class="mis show_mis"><span class="n"><a href="#t1873">1873</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.kablooey'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1874" class="mis show_mis"><span class="n"><a href="#t1874">1874</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1875" class="mis show_mis"><span class="n"><a href="#t1875">1875</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-Dfooey=kablooey'</span><span class="op">,</span> <span class="str">'-Dbar=quux'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1876" class="mis show_mis"><span class="n"><a href="#t1876">1876</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.kablooey'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1877" class="mis show_mis"><span class="n"><a href="#t1877">1877</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1878" class="mis show_mis"><span class="n"><a href="#t1878">1878</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-Dfooey=gooey'</span><span class="op">,</span> <span class="str">'-Dfooey=kablooey'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1879" class="mis show_mis"><span class="n"><a href="#t1879">1879</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.kablooey'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1880" class="pln"><span class="n"><a href="#t1880">1880</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1881" class="run"><span class="n"><a href="#t1881">1881</a></span><span class="t">    <span class="key">def</span> <span class="nam">testOutputToStdout</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1882" class="mis show_mis"><span class="n"><a href="#t1882">1882</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1883" class="pln"><span class="n"><a href="#t1883">1883</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1884" class="pln"><span class="n"><a href="#t1884">1884</a></span><span class="t"><span class="str">                --[[[cog cog.outl('Hey there!') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1885" class="pln"><span class="n"><a href="#t1885">1885</a></span><span class="t"><span class="str">                --[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1886" class="pln"><span class="n"><a href="#t1886">1886</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1887" class="pln"><span class="n"><a href="#t1887">1887</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1888" class="pln"><span class="n"><a href="#t1888">1888</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1889" class="mis show_mis"><span class="n"><a href="#t1889">1889</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1890" class="mis show_mis"><span class="n"><a href="#t1890">1890</a></span><span class="t">        <span class="nam">stderr</span> <span class="op">=</span> <span class="nam">StringIO</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1891" class="mis show_mis"><span class="n"><a href="#t1891">1891</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">setOutput</span><span class="op">(</span><span class="nam">stderr</span><span class="op">=</span><span class="nam">stderr</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1892" class="mis show_mis"><span class="n"><a href="#t1892">1892</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1893" class="mis show_mis"><span class="n"><a href="#t1893">1893</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1894" class="mis show_mis"><span class="n"><a href="#t1894">1894</a></span><span class="t">        <span class="nam">outerr</span> <span class="op">=</span> <span class="nam">stderr</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1895" class="mis show_mis"><span class="n"><a href="#t1895">1895</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">"--[[[cog cog.outl('Hey there!') ]]]\nHey there!\n--[[[end]]]\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1896" class="mis show_mis"><span class="n"><a href="#t1896">1896</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">outerr</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1897" class="pln"><span class="n"><a href="#t1897">1897</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1898" class="run"><span class="n"><a href="#t1898">1898</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReadFromStdin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1899" class="mis show_mis"><span class="n"><a href="#t1899">1899</a></span><span class="t">        <span class="nam">stdin</span> <span class="op">=</span> <span class="nam">StringIO</span><span class="op">(</span><span class="str">"--[[[cog cog.outl('Wow') ]]]\n--[[[end]]]\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1900" class="mis show_mis"><span class="n"><a href="#t1900">1900</a></span><span class="t">        <span class="key">def</span> <span class="nam">restore_stdin</span><span class="op">(</span><span class="nam">old_stdin</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1901" class="mis show_mis"><span class="n"><a href="#t1901">1901</a></span><span class="t">            <span class="nam">sys</span><span class="op">.</span><span class="nam">stdin</span> <span class="op">=</span> <span class="nam">old_stdin</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1902" class="mis show_mis"><span class="n"><a href="#t1902">1902</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">addCleanup</span><span class="op">(</span><span class="nam">restore_stdin</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdin</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1903" class="mis show_mis"><span class="n"><a href="#t1903">1903</a></span><span class="t">        <span class="nam">sys</span><span class="op">.</span><span class="nam">stdin</span> <span class="op">=</span> <span class="nam">stdin</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1904" class="pln"><span class="n"><a href="#t1904">1904</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1905" class="mis show_mis"><span class="n"><a href="#t1905">1905</a></span><span class="t">        <span class="nam">stderr</span> <span class="op">=</span> <span class="nam">StringIO</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1906" class="mis show_mis"><span class="n"><a href="#t1906">1906</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">setOutput</span><span class="op">(</span><span class="nam">stderr</span><span class="op">=</span><span class="nam">stderr</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1907" class="mis show_mis"><span class="n"><a href="#t1907">1907</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1908" class="mis show_mis"><span class="n"><a href="#t1908">1908</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1909" class="mis show_mis"><span class="n"><a href="#t1909">1909</a></span><span class="t">        <span class="nam">outerr</span> <span class="op">=</span> <span class="nam">stderr</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1910" class="mis show_mis"><span class="n"><a href="#t1910">1910</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">"--[[[cog cog.outl('Wow') ]]]\nWow\n--[[[end]]]\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1911" class="mis show_mis"><span class="n"><a href="#t1911">1911</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">outerr</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1912" class="pln"><span class="n"><a href="#t1912">1912</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1913" class="run"><span class="n"><a href="#t1913">1913</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSuffixOutputLines</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1914" class="mis show_mis"><span class="n"><a href="#t1914">1914</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1915" class="pln"><span class="n"><a href="#t1915">1915</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1916" class="pln"><span class="n"><a href="#t1916">1916</a></span><span class="t"><span class="str">                Hey there.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1917" class="pln"><span class="n"><a href="#t1917">1917</a></span><span class="t"><span class="str">                ;[[[cog cog.outl('a\\nb\\n   \\nc') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1918" class="pln"><span class="n"><a href="#t1918">1918</a></span><span class="t"><span class="str">                ;[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1919" class="pln"><span class="n"><a href="#t1919">1919</a></span><span class="t"><span class="str">                Good bye.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1920" class="pln"><span class="n"><a href="#t1920">1920</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1921" class="pln"><span class="n"><a href="#t1921">1921</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1922" class="pln"><span class="n"><a href="#t1922">1922</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1923" class="pln"><span class="n"><a href="#t1923">1923</a></span><span class="t"><span class="str">                Hey there.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1924" class="pln"><span class="n"><a href="#t1924">1924</a></span><span class="t"><span class="str">                ;[[[cog cog.outl('a\\nb\\n   \\nc') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1925" class="pln"><span class="n"><a href="#t1925">1925</a></span><span class="t"><span class="str">                a (foo)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1926" class="pln"><span class="n"><a href="#t1926">1926</a></span><span class="t"><span class="str">                b (foo)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1927" class="pln"><span class="n"><a href="#t1927">1927</a></span><span class="t"><span class="str">                   """</span>  <span class="com"># These three trailing spaces are important.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1928" class="pln"><span class="n"><a href="#t1928">1928</a></span><span class="t">                        <span class="com"># The suffix is not applied to completely blank lines.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1929" class="pln"><span class="n"><a href="#t1929">1929</a></span><span class="t">                <span class="str">"""</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1930" class="pln"><span class="n"><a href="#t1930">1930</a></span><span class="t"><span class="str">                c (foo)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1931" class="pln"><span class="n"><a href="#t1931">1931</a></span><span class="t"><span class="str">                ;[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1932" class="pln"><span class="n"><a href="#t1932">1932</a></span><span class="t"><span class="str">                Good bye.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1933" class="pln"><span class="n"><a href="#t1933">1933</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1934" class="pln"><span class="n"><a href="#t1934">1934</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1935" class="pln"><span class="n"><a href="#t1935">1935</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1936" class="mis show_mis"><span class="n"><a href="#t1936">1936</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1937" class="mis show_mis"><span class="n"><a href="#t1937">1937</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-s'</span><span class="op">,</span> <span class="str">' (foo)'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1938" class="mis show_mis"><span class="n"><a href="#t1938">1938</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1939" class="pln"><span class="n"><a href="#t1939">1939</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1940" class="run"><span class="n"><a href="#t1940">1940</a></span><span class="t">    <span class="key">def</span> <span class="nam">testEmptySuffix</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1941" class="mis show_mis"><span class="n"><a href="#t1941">1941</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1942" class="pln"><span class="n"><a href="#t1942">1942</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1943" class="pln"><span class="n"><a href="#t1943">1943</a></span><span class="t"><span class="str">                ;[[[cog cog.outl('a\\nb\\nc') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1944" class="pln"><span class="n"><a href="#t1944">1944</a></span><span class="t"><span class="str">                ;[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1945" class="pln"><span class="n"><a href="#t1945">1945</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1946" class="pln"><span class="n"><a href="#t1946">1946</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1947" class="pln"><span class="n"><a href="#t1947">1947</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1948" class="pln"><span class="n"><a href="#t1948">1948</a></span><span class="t"><span class="str">                ;[[[cog cog.outl('a\\nb\\nc') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1949" class="pln"><span class="n"><a href="#t1949">1949</a></span><span class="t"><span class="str">                a</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1950" class="pln"><span class="n"><a href="#t1950">1950</a></span><span class="t"><span class="str">                b</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1951" class="pln"><span class="n"><a href="#t1951">1951</a></span><span class="t"><span class="str">                c</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1952" class="pln"><span class="n"><a href="#t1952">1952</a></span><span class="t"><span class="str">                ;[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1953" class="pln"><span class="n"><a href="#t1953">1953</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1954" class="pln"><span class="n"><a href="#t1954">1954</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1955" class="pln"><span class="n"><a href="#t1955">1955</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1956" class="mis show_mis"><span class="n"><a href="#t1956">1956</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1957" class="mis show_mis"><span class="n"><a href="#t1957">1957</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-s'</span><span class="op">,</span> <span class="str">''</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1958" class="mis show_mis"><span class="n"><a href="#t1958">1958</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1959" class="pln"><span class="n"><a href="#t1959">1959</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1960" class="run"><span class="n"><a href="#t1960">1960</a></span><span class="t">    <span class="key">def</span> <span class="nam">testHellishSuffix</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1961" class="mis show_mis"><span class="n"><a href="#t1961">1961</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1962" class="pln"><span class="n"><a href="#t1962">1962</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1963" class="pln"><span class="n"><a href="#t1963">1963</a></span><span class="t"><span class="str">                ;[[[cog cog.outl('a\\n\\nb') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1964" class="pln"><span class="n"><a href="#t1964">1964</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1965" class="pln"><span class="n"><a href="#t1965">1965</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1966" class="pln"><span class="n"><a href="#t1966">1966</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1967" class="pln"><span class="n"><a href="#t1967">1967</a></span><span class="t"><span class="str">                ;[[[cog cog.outl('a\\n\\nb') ]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1968" class="pln"><span class="n"><a href="#t1968">1968</a></span><span class="t"><span class="str">                a /\\n*+([)]>&lt;</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1969" class="pln"><span class="n"><a href="#t1969">1969</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1970" class="pln"><span class="n"><a href="#t1970">1970</a></span><span class="t"><span class="str">                b /\\n*+([)]>&lt;</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1971" class="pln"><span class="n"><a href="#t1971">1971</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1972" class="pln"><span class="n"><a href="#t1972">1972</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1973" class="pln"><span class="n"><a href="#t1973">1973</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1974" class="mis show_mis"><span class="n"><a href="#t1974">1974</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1975" class="mis show_mis"><span class="n"><a href="#t1975">1975</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-z'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-s'</span><span class="op">,</span> <span class="str">r' /\n*+([)]>&lt;'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1976" class="mis show_mis"><span class="n"><a href="#t1976">1976</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1977" class="pln"><span class="n"><a href="#t1977">1977</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1978" class="run"><span class="n"><a href="#t1978">1978</a></span><span class="t">    <span class="key">def</span> <span class="nam">testPrologue</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1979" class="mis show_mis"><span class="n"><a href="#t1979">1979</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1980" class="pln"><span class="n"><a href="#t1980">1980</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1981" class="pln"><span class="n"><a href="#t1981">1981</a></span><span class="t"><span class="str">                Some text.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1982" class="pln"><span class="n"><a href="#t1982">1982</a></span><span class="t"><span class="str">                //[[[cog cog.outl(str(math.sqrt(2))[:12])]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1983" class="pln"><span class="n"><a href="#t1983">1983</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1984" class="pln"><span class="n"><a href="#t1984">1984</a></span><span class="t"><span class="str">                epilogue.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1985" class="pln"><span class="n"><a href="#t1985">1985</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1986" class="pln"><span class="n"><a href="#t1986">1986</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1987" class="pln"><span class="n"><a href="#t1987">1987</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1988" class="pln"><span class="n"><a href="#t1988">1988</a></span><span class="t"><span class="str">                Some text.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1989" class="pln"><span class="n"><a href="#t1989">1989</a></span><span class="t"><span class="str">                //[[[cog cog.outl(str(math.sqrt(2))[:12])]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1990" class="pln"><span class="n"><a href="#t1990">1990</a></span><span class="t"><span class="str">                1.4142135623</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1991" class="pln"><span class="n"><a href="#t1991">1991</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1992" class="pln"><span class="n"><a href="#t1992">1992</a></span><span class="t"><span class="str">                epilogue.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1993" class="pln"><span class="n"><a href="#t1993">1993</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1994" class="pln"><span class="n"><a href="#t1994">1994</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1995" class="pln"><span class="n"><a href="#t1995">1995</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t1996" class="mis show_mis"><span class="n"><a href="#t1996">1996</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1997" class="mis show_mis"><span class="n"><a href="#t1997">1997</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-p'</span><span class="op">,</span> <span class="str">'import math'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1998" class="mis show_mis"><span class="n"><a href="#t1998">1998</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t1999" class="pln"><span class="n"><a href="#t1999">1999</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2000" class="run"><span class="n"><a href="#t2000">2000</a></span><span class="t">    <span class="key">def</span> <span class="nam">testThreads</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2001" class="pln"><span class="n"><a href="#t2001">2001</a></span><span class="t">        <span class="com"># Test that the implictly imported cog module is actually different for</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2002" class="pln"><span class="n"><a href="#t2002">2002</a></span><span class="t">        <span class="com"># different threads.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2003" class="mis show_mis"><span class="n"><a href="#t2003">2003</a></span><span class="t">        <span class="nam">numthreads</span> <span class="op">=</span> <span class="num">20</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2004" class="pln"><span class="n"><a href="#t2004">2004</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2005" class="mis show_mis"><span class="n"><a href="#t2005">2005</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2006" class="mis show_mis"><span class="n"><a href="#t2006">2006</a></span><span class="t">        <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="nam">numthreads</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2007" class="mis show_mis"><span class="n"><a href="#t2007">2007</a></span><span class="t">            <span class="nam">d</span><span class="op">[</span><span class="str">'f{}.cog'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">i</span><span class="op">)</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2008" class="pln"><span class="n"><a href="#t2008">2008</a></span><span class="t">                <span class="str">"x\n"</span> <span class="op">*</span> <span class="nam">i</span> <span class="op">+</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2009" class="pln"><span class="n"><a href="#t2009">2009</a></span><span class="t">                <span class="str">"[[[cog\n"</span> <span class="op">+</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2010" class="pln"><span class="n"><a href="#t2010">2010</a></span><span class="t">                <span class="str">"assert cog.firstLineNum == int(FIRST) == {}\n"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">i</span><span class="op">+</span><span class="num">1</span><span class="op">)</span> <span class="op">+</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2011" class="pln"><span class="n"><a href="#t2011">2011</a></span><span class="t">                <span class="str">"]]]\n"</span> <span class="op">+</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2012" class="pln"><span class="n"><a href="#t2012">2012</a></span><span class="t">                <span class="str">"[[[end]]]\n"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2013" class="pln"><span class="n"><a href="#t2013">2013</a></span><span class="t">                <span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2014" class="mis show_mis"><span class="n"><a href="#t2014">2014</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2015" class="pln"><span class="n"><a href="#t2015">2015</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2016" class="mis show_mis"><span class="n"><a href="#t2016">2016</a></span><span class="t">        <span class="nam">results</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2017" class="pln"><span class="n"><a href="#t2017">2017</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2018" class="mis show_mis"><span class="n"><a href="#t2018">2018</a></span><span class="t">        <span class="key">def</span> <span class="nam">thread_main</span><span class="op">(</span><span class="nam">num</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2019" class="mis show_mis"><span class="n"><a href="#t2019">2019</a></span><span class="t">            <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2020" class="mis show_mis"><span class="n"><a href="#t2020">2020</a></span><span class="t">                <span class="nam">ret</span> <span class="op">=</span> <span class="nam">Cog</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2021" class="pln"><span class="n"><a href="#t2021">2021</a></span><span class="t">                    <span class="op">[</span><span class="str">'cog.py'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-D'</span><span class="op">,</span> <span class="str">'FIRST={}'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">num</span><span class="op">+</span><span class="num">1</span><span class="op">)</span><span class="op">,</span> <span class="str">'f{}.cog'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">num</span><span class="op">)</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2022" class="pln"><span class="n"><a href="#t2022">2022</a></span><span class="t">                    <span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2023" class="mis show_mis"><span class="n"><a href="#t2023">2023</a></span><span class="t">                <span class="key">assert</span> <span class="nam">ret</span> <span class="op">==</span> <span class="num">0</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2024" class="mis show_mis"><span class="n"><a href="#t2024">2024</a></span><span class="t">            <span class="key">except</span> <span class="nam">Exception</span> <span class="key">as</span> <span class="nam">exc</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2025" class="mis show_mis"><span class="n"><a href="#t2025">2025</a></span><span class="t">                <span class="nam">results</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">exc</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2026" class="pln"><span class="n"><a href="#t2026">2026</a></span><span class="t">            <span class="key">else</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2027" class="mis show_mis"><span class="n"><a href="#t2027">2027</a></span><span class="t">                <span class="nam">results</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="key">None</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2028" class="pln"><span class="n"><a href="#t2028">2028</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2029" class="mis show_mis"><span class="n"><a href="#t2029">2029</a></span><span class="t">        <span class="nam">ts</span> <span class="op">=</span> <span class="op">[</span><span class="nam">threading</span><span class="op">.</span><span class="nam">Thread</span><span class="op">(</span><span class="nam">target</span><span class="op">=</span><span class="nam">thread_main</span><span class="op">,</span> <span class="nam">args</span><span class="op">=</span><span class="op">(</span><span class="nam">i</span><span class="op">,</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="nam">numthreads</span><span class="op">)</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2030" class="mis show_mis"><span class="n"><a href="#t2030">2030</a></span><span class="t">        <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">ts</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2031" class="mis show_mis"><span class="n"><a href="#t2031">2031</a></span><span class="t">            <span class="nam">t</span><span class="op">.</span><span class="nam">start</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2032" class="mis show_mis"><span class="n"><a href="#t2032">2032</a></span><span class="t">        <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">ts</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2033" class="mis show_mis"><span class="n"><a href="#t2033">2033</a></span><span class="t">            <span class="nam">t</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2034" class="mis show_mis"><span class="n"><a href="#t2034">2034</a></span><span class="t">        <span class="key">assert</span> <span class="nam">results</span> <span class="op">==</span> <span class="op">[</span><span class="key">None</span><span class="op">]</span> <span class="op">*</span> <span class="nam">numthreads</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2035" class="pln"><span class="n"><a href="#t2035">2035</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2036" class="pln"><span class="n"><a href="#t2036">2036</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2037" class="run"><span class="n"><a href="#t2037">2037</a></span><span class="t"><span class="key">class</span> <span class="nam">WritabilityTests</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2038" class="pln"><span class="n"><a href="#t2038">2038</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2039" class="run"><span class="n"><a href="#t2039">2039</a></span><span class="t">    <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2040" class="pln"><span class="n"><a href="#t2040">2040</a></span><span class="t">        <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2041" class="pln"><span class="n"><a href="#t2041">2041</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2042" class="pln"><span class="n"><a href="#t2042">2042</a></span><span class="t"><span class="str">            for fn in ['DoSomething', 'DoAnotherThing', 'DoLastThing']:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2043" class="pln"><span class="n"><a href="#t2043">2043</a></span><span class="t"><span class="str">                cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2044" class="pln"><span class="n"><a href="#t2044">2044</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2045" class="pln"><span class="n"><a href="#t2045">2045</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2046" class="pln"><span class="n"><a href="#t2046">2046</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2047" class="pln"><span class="n"><a href="#t2047">2047</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2048" class="pln"><span class="n"><a href="#t2048">2048</a></span><span class="t">        <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2049" class="pln"><span class="n"><a href="#t2049">2049</a></span><span class="t"><span class="str">            //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2050" class="pln"><span class="n"><a href="#t2050">2050</a></span><span class="t"><span class="str">            for fn in ['DoSomething', 'DoAnotherThing', 'DoLastThing']:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2051" class="pln"><span class="n"><a href="#t2051">2051</a></span><span class="t"><span class="str">                cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2052" class="pln"><span class="n"><a href="#t2052">2052</a></span><span class="t"><span class="str">            //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2053" class="pln"><span class="n"><a href="#t2053">2053</a></span><span class="t"><span class="str">            void DoSomething();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2054" class="pln"><span class="n"><a href="#t2054">2054</a></span><span class="t"><span class="str">            void DoAnotherThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2055" class="pln"><span class="n"><a href="#t2055">2055</a></span><span class="t"><span class="str">            void DoLastThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2056" class="pln"><span class="n"><a href="#t2056">2056</a></span><span class="t"><span class="str">            //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2057" class="pln"><span class="n"><a href="#t2057">2057</a></span><span class="t"><span class="str">            """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2058" class="pln"><span class="n"><a href="#t2058">2058</a></span><span class="t">        <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2059" class="pln"><span class="n"><a href="#t2059">2059</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2060" class="exc show_exc"><span class="n"><a href="#t2060">2060</a></span><span class="t">    <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">'nt'</span><span class="op">:</span>     <span class="com">#pragma: no cover</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2061" class="pln"><span class="n"><a href="#t2061">2061</a></span><span class="t">        <span class="com"># for Windows</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2062" class="exc show_exc"><span class="n"><a href="#t2062">2062</a></span><span class="t">        <span class="nam">cmd_w_args</span> <span class="op">=</span> <span class="str">'attrib -R %s'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2063" class="exc show_exc"><span class="n"><a href="#t2063">2063</a></span><span class="t">        <span class="nam">cmd_w_asterisk</span> <span class="op">=</span> <span class="str">'attrib -R *'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2064" class="exc show_exc"><span class="n"><a href="#t2064">2064</a></span><span class="t">    <span class="key">else</span><span class="op">:</span>   <span class="com">#pragma: no cover</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2065" class="pln"><span class="n"><a href="#t2065">2065</a></span><span class="t">        <span class="com"># for unix-like</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2066" class="exc show_exc"><span class="n"><a href="#t2066">2066</a></span><span class="t">        <span class="nam">cmd_w_args</span> <span class="op">=</span> <span class="str">'chmod +w %s'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2067" class="exc show_exc"><span class="n"><a href="#t2067">2067</a></span><span class="t">        <span class="nam">cmd_w_asterisk</span> <span class="op">=</span> <span class="str">'chmod +w *'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2068" class="pln"><span class="n"><a href="#t2068">2068</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2069" class="run"><span class="n"><a href="#t2069">2069</a></span><span class="t">    <span class="key">def</span> <span class="nam">setUp</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2070" class="mis show_mis"><span class="n"><a href="#t2070">2070</a></span><span class="t">        <span class="nam">super</span><span class="op">(</span><span class="nam">WritabilityTests</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">setUp</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2071" class="mis show_mis"><span class="n"><a href="#t2071">2071</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2072" class="mis show_mis"><span class="n"><a href="#t2072">2072</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">tempdir</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2073" class="mis show_mis"><span class="n"><a href="#t2073">2073</a></span><span class="t">        <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_IREAD</span><span class="op">)</span>   <span class="com"># Make the file readonly.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2074" class="mis show_mis"><span class="n"><a href="#t2074">2074</a></span><span class="t">        <span class="key">assert</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">access</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">W_OK</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2075" class="pln"><span class="n"><a href="#t2075">2075</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2076" class="run"><span class="n"><a href="#t2076">2076</a></span><span class="t">    <span class="key">def</span> <span class="nam">tearDown</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2077" class="mis show_mis"><span class="n"><a href="#t2077">2077</a></span><span class="t">        <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_IWRITE</span><span class="op">)</span>   <span class="com"># Make the file writable again.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2078" class="mis show_mis"><span class="n"><a href="#t2078">2078</a></span><span class="t">        <span class="nam">super</span><span class="op">(</span><span class="nam">WritabilityTests</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">tearDown</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2079" class="pln"><span class="n"><a href="#t2079">2079</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2080" class="run"><span class="n"><a href="#t2080">2080</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReadonlyNoCommand</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2081" class="mis show_mis"><span class="n"><a href="#t2081">2081</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">"^Can't overwrite test.cog$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2082" class="mis show_mis"><span class="n"><a href="#t2082">2082</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2083" class="mis show_mis"><span class="n"><a href="#t2083">2083</a></span><span class="t">        <span class="key">assert</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">access</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">W_OK</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2084" class="pln"><span class="n"><a href="#t2084">2084</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2085" class="run"><span class="n"><a href="#t2085">2085</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReadonlyWithCommand</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2086" class="mis show_mis"><span class="n"><a href="#t2086">2086</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-w'</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cmd_w_args</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2087" class="mis show_mis"><span class="n"><a href="#t2087">2087</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2088" class="mis show_mis"><span class="n"><a href="#t2088">2088</a></span><span class="t">        <span class="key">assert</span> <span class="nam">os</span><span class="op">.</span><span class="nam">access</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">W_OK</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2089" class="pln"><span class="n"><a href="#t2089">2089</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2090" class="run"><span class="n"><a href="#t2090">2090</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReadonlyWithCommandWithNoSlot</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2091" class="mis show_mis"><span class="n"><a href="#t2091">2091</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-w'</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cmd_w_asterisk</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2092" class="mis show_mis"><span class="n"><a href="#t2092">2092</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2093" class="mis show_mis"><span class="n"><a href="#t2093">2093</a></span><span class="t">        <span class="key">assert</span> <span class="nam">os</span><span class="op">.</span><span class="nam">access</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">W_OK</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2094" class="pln"><span class="n"><a href="#t2094">2094</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2095" class="run"><span class="n"><a href="#t2095">2095</a></span><span class="t">    <span class="key">def</span> <span class="nam">testReadonlyWithIneffectualCommand</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2096" class="mis show_mis"><span class="n"><a href="#t2096">2096</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span> <span class="str">"^Couldn't make test.cog writable$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2097" class="mis show_mis"><span class="n"><a href="#t2097">2097</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-w'</span><span class="op">,</span> <span class="str">'echo %s'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2098" class="mis show_mis"><span class="n"><a href="#t2098">2098</a></span><span class="t">        <span class="key">assert</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">access</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">testcog</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">W_OK</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2099" class="pln"><span class="n"><a href="#t2099">2099</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2100" class="pln"><span class="n"><a href="#t2100">2100</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2101" class="run"><span class="n"><a href="#t2101">2101</a></span><span class="t"><span class="key">class</span> <span class="nam">ChecksumTests</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2102" class="pln"><span class="n"><a href="#t2102">2102</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2103" class="run"><span class="n"><a href="#t2103">2103</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCreateChecksumOutput</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2104" class="mis show_mis"><span class="n"><a href="#t2104">2104</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2105" class="pln"><span class="n"><a href="#t2105">2105</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2106" class="pln"><span class="n"><a href="#t2106">2106</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2107" class="pln"><span class="n"><a href="#t2107">2107</a></span><span class="t"><span class="str">                cog.outl("This line was generated.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2108" class="pln"><span class="n"><a href="#t2108">2108</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2109" class="pln"><span class="n"><a href="#t2109">2109</a></span><span class="t"><span class="str">                This line was generated.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2110" class="pln"><span class="n"><a href="#t2110">2110</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2111" class="pln"><span class="n"><a href="#t2111">2111</a></span><span class="t"><span class="str">                This line was not.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2112" class="pln"><span class="n"><a href="#t2112">2112</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2113" class="pln"><span class="n"><a href="#t2113">2113</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2114" class="pln"><span class="n"><a href="#t2114">2114</a></span><span class="t">            <span class="str">'cog1.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2115" class="pln"><span class="n"><a href="#t2115">2115</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2116" class="pln"><span class="n"><a href="#t2116">2116</a></span><span class="t"><span class="str">                cog.outl("This line was generated.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2117" class="pln"><span class="n"><a href="#t2117">2117</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2118" class="pln"><span class="n"><a href="#t2118">2118</a></span><span class="t"><span class="str">                This line was generated.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2119" class="pln"><span class="n"><a href="#t2119">2119</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2120" class="pln"><span class="n"><a href="#t2120">2120</a></span><span class="t"><span class="str">                This line was not.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2121" class="pln"><span class="n"><a href="#t2121">2121</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2122" class="pln"><span class="n"><a href="#t2122">2122</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2123" class="pln"><span class="n"><a href="#t2123">2123</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2124" class="mis show_mis"><span class="n"><a href="#t2124">2124</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2125" class="mis show_mis"><span class="n"><a href="#t2125">2125</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2126" class="mis show_mis"><span class="n"><a href="#t2126">2126</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2127" class="pln"><span class="n"><a href="#t2127">2127</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2128" class="run"><span class="n"><a href="#t2128">2128</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCheckChecksumOutput</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2129" class="mis show_mis"><span class="n"><a href="#t2129">2129</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2130" class="pln"><span class="n"><a href="#t2130">2130</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2131" class="pln"><span class="n"><a href="#t2131">2131</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2132" class="pln"><span class="n"><a href="#t2132">2132</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2133" class="pln"><span class="n"><a href="#t2133">2133</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2134" class="pln"><span class="n"><a href="#t2134">2134</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2135" class="pln"><span class="n"><a href="#t2135">2135</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2136" class="pln"><span class="n"><a href="#t2136">2136</a></span><span class="t"><span class="str">                This line was generated.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2137" class="pln"><span class="n"><a href="#t2137">2137</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2138" class="pln"><span class="n"><a href="#t2138">2138</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2139" class="pln"><span class="n"><a href="#t2139">2139</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2140" class="pln"><span class="n"><a href="#t2140">2140</a></span><span class="t">            <span class="str">'cog1.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2141" class="pln"><span class="n"><a href="#t2141">2141</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2142" class="pln"><span class="n"><a href="#t2142">2142</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2143" class="pln"><span class="n"><a href="#t2143">2143</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2144" class="pln"><span class="n"><a href="#t2144">2144</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2145" class="pln"><span class="n"><a href="#t2145">2145</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2146" class="pln"><span class="n"><a href="#t2146">2146</a></span><span class="t"><span class="str">                This line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2147" class="pln"><span class="n"><a href="#t2147">2147</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2148" class="pln"><span class="n"><a href="#t2148">2148</a></span><span class="t"><span class="str">                blah blah.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2149" class="pln"><span class="n"><a href="#t2149">2149</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2150" class="pln"><span class="n"><a href="#t2150">2150</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2151" class="pln"><span class="n"><a href="#t2151">2151</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2152" class="pln"><span class="n"><a href="#t2152">2152</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2153" class="mis show_mis"><span class="n"><a href="#t2153">2153</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2154" class="mis show_mis"><span class="n"><a href="#t2154">2154</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2155" class="mis show_mis"><span class="n"><a href="#t2155">2155</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2156" class="pln"><span class="n"><a href="#t2156">2156</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2157" class="run"><span class="n"><a href="#t2157">2157</a></span><span class="t">    <span class="key">def</span> <span class="nam">testRemoveChecksumOutput</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2158" class="mis show_mis"><span class="n"><a href="#t2158">2158</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2159" class="pln"><span class="n"><a href="#t2159">2159</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2160" class="pln"><span class="n"><a href="#t2160">2160</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2161" class="pln"><span class="n"><a href="#t2161">2161</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2162" class="pln"><span class="n"><a href="#t2162">2162</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2163" class="pln"><span class="n"><a href="#t2163">2163</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2164" class="pln"><span class="n"><a href="#t2164">2164</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2165" class="pln"><span class="n"><a href="#t2165">2165</a></span><span class="t"><span class="str">                This line was generated.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2166" class="pln"><span class="n"><a href="#t2166">2166</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2167" class="pln"><span class="n"><a href="#t2167">2167</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2168" class="pln"><span class="n"><a href="#t2168">2168</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2169" class="pln"><span class="n"><a href="#t2169">2169</a></span><span class="t">            <span class="str">'cog1.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2170" class="pln"><span class="n"><a href="#t2170">2170</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2171" class="pln"><span class="n"><a href="#t2171">2171</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2172" class="pln"><span class="n"><a href="#t2172">2172</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2173" class="pln"><span class="n"><a href="#t2173">2173</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2174" class="pln"><span class="n"><a href="#t2174">2174</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2175" class="pln"><span class="n"><a href="#t2175">2175</a></span><span class="t"><span class="str">                This line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2176" class="pln"><span class="n"><a href="#t2176">2176</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2177" class="pln"><span class="n"><a href="#t2177">2177</a></span><span class="t"><span class="str">                blah blah.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2178" class="pln"><span class="n"><a href="#t2178">2178</a></span><span class="t"><span class="str">                //[[[end]]] fooey</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2179" class="pln"><span class="n"><a href="#t2179">2179</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2180" class="pln"><span class="n"><a href="#t2180">2180</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2181" class="pln"><span class="n"><a href="#t2181">2181</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2182" class="mis show_mis"><span class="n"><a href="#t2182">2182</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2183" class="mis show_mis"><span class="n"><a href="#t2183">2183</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'cog1.txt'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2184" class="mis show_mis"><span class="n"><a href="#t2184">2184</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'cog1.txt'</span><span class="op">,</span> <span class="str">'cog1.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2185" class="pln"><span class="n"><a href="#t2185">2185</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2186" class="run"><span class="n"><a href="#t2186">2186</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTamperedChecksumOutput</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2187" class="mis show_mis"><span class="n"><a href="#t2187">2187</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2188" class="pln"><span class="n"><a href="#t2188">2188</a></span><span class="t">            <span class="str">'cog1.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2189" class="pln"><span class="n"><a href="#t2189">2189</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2190" class="pln"><span class="n"><a href="#t2190">2190</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2191" class="pln"><span class="n"><a href="#t2191">2191</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2192" class="pln"><span class="n"><a href="#t2192">2192</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2193" class="pln"><span class="n"><a href="#t2193">2193</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2194" class="pln"><span class="n"><a href="#t2194">2194</a></span><span class="t"><span class="str">                Xhis line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2195" class="pln"><span class="n"><a href="#t2195">2195</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2196" class="pln"><span class="n"><a href="#t2196">2196</a></span><span class="t"><span class="str">                blah blah.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2197" class="pln"><span class="n"><a href="#t2197">2197</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2198" class="pln"><span class="n"><a href="#t2198">2198</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2199" class="pln"><span class="n"><a href="#t2199">2199</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2200" class="pln"><span class="n"><a href="#t2200">2200</a></span><span class="t">            <span class="str">'cog2.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2201" class="pln"><span class="n"><a href="#t2201">2201</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2202" class="pln"><span class="n"><a href="#t2202">2202</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2203" class="pln"><span class="n"><a href="#t2203">2203</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2204" class="pln"><span class="n"><a href="#t2204">2204</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2205" class="pln"><span class="n"><a href="#t2205">2205</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2206" class="pln"><span class="n"><a href="#t2206">2206</a></span><span class="t"><span class="str">                This line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2207" class="pln"><span class="n"><a href="#t2207">2207</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2208" class="pln"><span class="n"><a href="#t2208">2208</a></span><span class="t"><span class="str">                blah blah!</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2209" class="pln"><span class="n"><a href="#t2209">2209</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2210" class="pln"><span class="n"><a href="#t2210">2210</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2211" class="pln"><span class="n"><a href="#t2211">2211</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2212" class="pln"><span class="n"><a href="#t2212">2212</a></span><span class="t">            <span class="str">'cog3.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2213" class="pln"><span class="n"><a href="#t2213">2213</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2214" class="pln"><span class="n"><a href="#t2214">2214</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2215" class="pln"><span class="n"><a href="#t2215">2215</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2216" class="pln"><span class="n"><a href="#t2216">2216</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2217" class="pln"><span class="n"><a href="#t2217">2217</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2218" class="pln"><span class="n"><a href="#t2218">2218</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2219" class="pln"><span class="n"><a href="#t2219">2219</a></span><span class="t"><span class="str">                This line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2220" class="pln"><span class="n"><a href="#t2220">2220</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2221" class="pln"><span class="n"><a href="#t2221">2221</a></span><span class="t"><span class="str">                blah blah.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2222" class="pln"><span class="n"><a href="#t2222">2222</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2223" class="pln"><span class="n"><a href="#t2223">2223</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2224" class="pln"><span class="n"><a href="#t2224">2224</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2225" class="pln"><span class="n"><a href="#t2225">2225</a></span><span class="t">            <span class="str">'cog4.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2226" class="pln"><span class="n"><a href="#t2226">2226</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2227" class="pln"><span class="n"><a href="#t2227">2227</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2228" class="pln"><span class="n"><a href="#t2228">2228</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2229" class="pln"><span class="n"><a href="#t2229">2229</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2230" class="pln"><span class="n"><a href="#t2230">2230</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2231" class="pln"><span class="n"><a href="#t2231">2231</a></span><span class="t"><span class="str">                This line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2232" class="pln"><span class="n"><a href="#t2232">2232</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2233" class="pln"><span class="n"><a href="#t2233">2233</a></span><span class="t"><span class="str">                blah blah..</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2234" class="pln"><span class="n"><a href="#t2234">2234</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2235" class="pln"><span class="n"><a href="#t2235">2235</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2236" class="pln"><span class="n"><a href="#t2236">2236</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2237" class="pln"><span class="n"><a href="#t2237">2237</a></span><span class="t">            <span class="str">'cog5.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2238" class="pln"><span class="n"><a href="#t2238">2238</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2239" class="pln"><span class="n"><a href="#t2239">2239</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2240" class="pln"><span class="n"><a href="#t2240">2240</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2241" class="pln"><span class="n"><a href="#t2241">2241</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2242" class="pln"><span class="n"><a href="#t2242">2242</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2243" class="pln"><span class="n"><a href="#t2243">2243</a></span><span class="t"><span class="str">                This line was newly</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2244" class="pln"><span class="n"><a href="#t2244">2244</a></span><span class="t"><span class="str">                generated by cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2245" class="pln"><span class="n"><a href="#t2245">2245</a></span><span class="t"><span class="str">                blah blah.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2246" class="pln"><span class="n"><a href="#t2246">2246</a></span><span class="t"><span class="str">                extra</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2247" class="pln"><span class="n"><a href="#t2247">2247</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2248" class="pln"><span class="n"><a href="#t2248">2248</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2249" class="pln"><span class="n"><a href="#t2249">2249</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2250" class="pln"><span class="n"><a href="#t2250">2250</a></span><span class="t">            <span class="str">'cog6.txt'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2251" class="pln"><span class="n"><a href="#t2251">2251</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2252" class="pln"><span class="n"><a href="#t2252">2252</a></span><span class="t"><span class="str">                cog.outl("This line was newly")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2253" class="pln"><span class="n"><a href="#t2253">2253</a></span><span class="t"><span class="str">                cog.outl("generated by cog")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2254" class="pln"><span class="n"><a href="#t2254">2254</a></span><span class="t"><span class="str">                cog.outl("blah blah.")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2255" class="pln"><span class="n"><a href="#t2255">2255</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2256" class="pln"><span class="n"><a href="#t2256">2256</a></span><span class="t"><span class="str">                //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2257" class="pln"><span class="n"><a href="#t2257">2257</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2258" class="pln"><span class="n"><a href="#t2258">2258</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2259" class="pln"><span class="n"><a href="#t2259">2259</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2260" class="mis show_mis"><span class="n"><a href="#t2260">2260</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2261" class="mis show_mis"><span class="n"><a href="#t2261">2261</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2262" class="pln"><span class="n"><a href="#t2262">2262</a></span><span class="t">            <span class="str">r"^cog1.txt\(9\): Output has been edited! Delete old checksum to unprotect.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2263" class="mis show_mis"><span class="n"><a href="#t2263">2263</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">"cog1.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2264" class="mis show_mis"><span class="n"><a href="#t2264">2264</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2265" class="pln"><span class="n"><a href="#t2265">2265</a></span><span class="t">            <span class="str">r"^cog2.txt\(9\): Output has been edited! Delete old checksum to unprotect.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2266" class="mis show_mis"><span class="n"><a href="#t2266">2266</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">"cog2.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2267" class="mis show_mis"><span class="n"><a href="#t2267">2267</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2268" class="pln"><span class="n"><a href="#t2268">2268</a></span><span class="t">            <span class="str">r"^cog3.txt\(10\): Output has been edited! Delete old checksum to unprotect.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2269" class="mis show_mis"><span class="n"><a href="#t2269">2269</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">"cog3.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2270" class="mis show_mis"><span class="n"><a href="#t2270">2270</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2271" class="pln"><span class="n"><a href="#t2271">2271</a></span><span class="t">            <span class="str">r"^cog4.txt\(9\): Output has been edited! Delete old checksum to unprotect.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2272" class="mis show_mis"><span class="n"><a href="#t2272">2272</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">"cog4.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2273" class="mis show_mis"><span class="n"><a href="#t2273">2273</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2274" class="pln"><span class="n"><a href="#t2274">2274</a></span><span class="t">            <span class="str">r"^cog5.txt\(10\): Output has been edited! Delete old checksum to unprotect.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2275" class="mis show_mis"><span class="n"><a href="#t2275">2275</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">"cog5.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2276" class="mis show_mis"><span class="n"><a href="#t2276">2276</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogError</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2277" class="pln"><span class="n"><a href="#t2277">2277</a></span><span class="t">            <span class="str">r"^cog6.txt\(6\): Output has been edited! Delete old checksum to unprotect.$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2278" class="mis show_mis"><span class="n"><a href="#t2278">2278</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-c'</span><span class="op">,</span> <span class="str">"cog6.txt"</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2279" class="pln"><span class="n"><a href="#t2279">2279</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2280" class="run"><span class="n"><a href="#t2280">2280</a></span><span class="t">    <span class="key">def</span> <span class="nam">testArgvIsntModified</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2281" class="mis show_mis"><span class="n"><a href="#t2281">2281</a></span><span class="t">        <span class="nam">argv</span> <span class="op">=</span> <span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-v'</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2282" class="mis show_mis"><span class="n"><a href="#t2282">2282</a></span><span class="t">        <span class="nam">orig_argv</span> <span class="op">=</span> <span class="nam">argv</span><span class="op">[</span><span class="op">:</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2283" class="mis show_mis"><span class="n"><a href="#t2283">2283</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="nam">argv</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2284" class="mis show_mis"><span class="n"><a href="#t2284">2284</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">argv</span><span class="op">,</span> <span class="nam">orig_argv</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2285" class="pln"><span class="n"><a href="#t2285">2285</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2286" class="pln"><span class="n"><a href="#t2286">2286</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2287" class="run"><span class="n"><a href="#t2287">2287</a></span><span class="t"><span class="key">class</span> <span class="nam">CustomMarkerTests</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2288" class="pln"><span class="n"><a href="#t2288">2288</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2289" class="run"><span class="n"><a href="#t2289">2289</a></span><span class="t">    <span class="key">def</span> <span class="nam">testCustomerMarkers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2290" class="mis show_mis"><span class="n"><a href="#t2290">2290</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2291" class="pln"><span class="n"><a href="#t2291">2291</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2292" class="pln"><span class="n"><a href="#t2292">2292</a></span><span class="t"><span class="str">                //{{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2293" class="pln"><span class="n"><a href="#t2293">2293</a></span><span class="t"><span class="str">                cog.outl("void %s();" % "MyFunction")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2294" class="pln"><span class="n"><a href="#t2294">2294</a></span><span class="t"><span class="str">                //}}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2295" class="pln"><span class="n"><a href="#t2295">2295</a></span><span class="t"><span class="str">                //{{end}}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2296" class="pln"><span class="n"><a href="#t2296">2296</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2297" class="pln"><span class="n"><a href="#t2297">2297</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2298" class="pln"><span class="n"><a href="#t2298">2298</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2299" class="pln"><span class="n"><a href="#t2299">2299</a></span><span class="t"><span class="str">                //{{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2300" class="pln"><span class="n"><a href="#t2300">2300</a></span><span class="t"><span class="str">                cog.outl("void %s();" % "MyFunction")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2301" class="pln"><span class="n"><a href="#t2301">2301</a></span><span class="t"><span class="str">                //}}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2302" class="pln"><span class="n"><a href="#t2302">2302</a></span><span class="t"><span class="str">                void MyFunction();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2303" class="pln"><span class="n"><a href="#t2303">2303</a></span><span class="t"><span class="str">                //{{end}}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2304" class="pln"><span class="n"><a href="#t2304">2304</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2305" class="pln"><span class="n"><a href="#t2305">2305</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2306" class="pln"><span class="n"><a href="#t2306">2306</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2307" class="mis show_mis"><span class="n"><a href="#t2307">2307</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2308" class="mis show_mis"><span class="n"><a href="#t2308">2308</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2309" class="pln"><span class="n"><a href="#t2309">2309</a></span><span class="t">            <span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2310" class="pln"><span class="n"><a href="#t2310">2310</a></span><span class="t">            <span class="str">'--markers={{ }} {{end}}'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2311" class="pln"><span class="n"><a href="#t2311">2311</a></span><span class="t">            <span class="str">'test.cog'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2312" class="pln"><span class="n"><a href="#t2312">2312</a></span><span class="t">        <span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2313" class="mis show_mis"><span class="n"><a href="#t2313">2313</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2314" class="pln"><span class="n"><a href="#t2314">2314</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2315" class="run"><span class="n"><a href="#t2315">2315</a></span><span class="t">    <span class="key">def</span> <span class="nam">testTrulyWackyMarkers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2316" class="pln"><span class="n"><a href="#t2316">2316</a></span><span class="t">        <span class="com"># Make sure the markers are properly re-escaped.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2317" class="mis show_mis"><span class="n"><a href="#t2317">2317</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2318" class="pln"><span class="n"><a href="#t2318">2318</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2319" class="pln"><span class="n"><a href="#t2319">2319</a></span><span class="t"><span class="str">                //**(</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2320" class="pln"><span class="n"><a href="#t2320">2320</a></span><span class="t"><span class="str">                cog.outl("void %s();" % "MyFunction")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2321" class="pln"><span class="n"><a href="#t2321">2321</a></span><span class="t"><span class="str">                //**)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2322" class="pln"><span class="n"><a href="#t2322">2322</a></span><span class="t"><span class="str">                //**(end)**</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2323" class="pln"><span class="n"><a href="#t2323">2323</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2324" class="pln"><span class="n"><a href="#t2324">2324</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2325" class="pln"><span class="n"><a href="#t2325">2325</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2326" class="pln"><span class="n"><a href="#t2326">2326</a></span><span class="t"><span class="str">                //**(</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2327" class="pln"><span class="n"><a href="#t2327">2327</a></span><span class="t"><span class="str">                cog.outl("void %s();" % "MyFunction")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2328" class="pln"><span class="n"><a href="#t2328">2328</a></span><span class="t"><span class="str">                //**)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2329" class="pln"><span class="n"><a href="#t2329">2329</a></span><span class="t"><span class="str">                void MyFunction();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2330" class="pln"><span class="n"><a href="#t2330">2330</a></span><span class="t"><span class="str">                //**(end)**</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2331" class="pln"><span class="n"><a href="#t2331">2331</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2332" class="pln"><span class="n"><a href="#t2332">2332</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2333" class="pln"><span class="n"><a href="#t2333">2333</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2334" class="mis show_mis"><span class="n"><a href="#t2334">2334</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2335" class="mis show_mis"><span class="n"><a href="#t2335">2335</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2336" class="pln"><span class="n"><a href="#t2336">2336</a></span><span class="t">            <span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2337" class="pln"><span class="n"><a href="#t2337">2337</a></span><span class="t">            <span class="str">'--markers=**( **) **(end)**'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2338" class="pln"><span class="n"><a href="#t2338">2338</a></span><span class="t">            <span class="str">'test.cog'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2339" class="pln"><span class="n"><a href="#t2339">2339</a></span><span class="t">        <span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2340" class="mis show_mis"><span class="n"><a href="#t2340">2340</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2341" class="pln"><span class="n"><a href="#t2341">2341</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2342" class="run"><span class="n"><a href="#t2342">2342</a></span><span class="t">    <span class="key">def</span> <span class="nam">testChangeJustOneMarker</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2343" class="mis show_mis"><span class="n"><a href="#t2343">2343</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2344" class="pln"><span class="n"><a href="#t2344">2344</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2345" class="pln"><span class="n"><a href="#t2345">2345</a></span><span class="t"><span class="str">                //**(</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2346" class="pln"><span class="n"><a href="#t2346">2346</a></span><span class="t"><span class="str">                cog.outl("void %s();" % "MyFunction")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2347" class="pln"><span class="n"><a href="#t2347">2347</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2348" class="pln"><span class="n"><a href="#t2348">2348</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2349" class="pln"><span class="n"><a href="#t2349">2349</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2350" class="pln"><span class="n"><a href="#t2350">2350</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2351" class="pln"><span class="n"><a href="#t2351">2351</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2352" class="pln"><span class="n"><a href="#t2352">2352</a></span><span class="t"><span class="str">                //**(</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2353" class="pln"><span class="n"><a href="#t2353">2353</a></span><span class="t"><span class="str">                cog.outl("void %s();" % "MyFunction")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2354" class="pln"><span class="n"><a href="#t2354">2354</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2355" class="pln"><span class="n"><a href="#t2355">2355</a></span><span class="t"><span class="str">                void MyFunction();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2356" class="pln"><span class="n"><a href="#t2356">2356</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2357" class="pln"><span class="n"><a href="#t2357">2357</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2358" class="pln"><span class="n"><a href="#t2358">2358</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2359" class="pln"><span class="n"><a href="#t2359">2359</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2360" class="mis show_mis"><span class="n"><a href="#t2360">2360</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2361" class="mis show_mis"><span class="n"><a href="#t2361">2361</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2362" class="pln"><span class="n"><a href="#t2362">2362</a></span><span class="t">            <span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2363" class="pln"><span class="n"><a href="#t2363">2363</a></span><span class="t">            <span class="str">'--markers=**( ]]] [[[end]]]'</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2364" class="pln"><span class="n"><a href="#t2364">2364</a></span><span class="t">            <span class="str">'test.cog'</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2365" class="pln"><span class="n"><a href="#t2365">2365</a></span><span class="t">        <span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2366" class="mis show_mis"><span class="n"><a href="#t2366">2366</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2367" class="pln"><span class="n"><a href="#t2367">2367</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2368" class="pln"><span class="n"><a href="#t2368">2368</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2369" class="run"><span class="n"><a href="#t2369">2369</a></span><span class="t"><span class="key">class</span> <span class="nam">BlakeTests</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2370" class="pln"><span class="n"><a href="#t2370">2370</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2371" class="pln"><span class="n"><a href="#t2371">2371</a></span><span class="t">    <span class="com"># Blake Winton's contributions.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2372" class="run"><span class="n"><a href="#t2372">2372</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDeleteCode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2373" class="pln"><span class="n"><a href="#t2373">2373</a></span><span class="t">        <span class="com"># -o sets the output file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2374" class="mis show_mis"><span class="n"><a href="#t2374">2374</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2375" class="pln"><span class="n"><a href="#t2375">2375</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2376" class="pln"><span class="n"><a href="#t2376">2376</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2377" class="pln"><span class="n"><a href="#t2377">2377</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2378" class="pln"><span class="n"><a href="#t2378">2378</a></span><span class="t"><span class="str">                fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2379" class="pln"><span class="n"><a href="#t2379">2379</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2380" class="pln"><span class="n"><a href="#t2380">2380</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2381" class="pln"><span class="n"><a href="#t2381">2381</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2382" class="pln"><span class="n"><a href="#t2382">2382</a></span><span class="t"><span class="str">                Some Sample Code Here</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2383" class="pln"><span class="n"><a href="#t2383">2383</a></span><span class="t"><span class="str">                //[[[end]]]Data Data</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2384" class="pln"><span class="n"><a href="#t2384">2384</a></span><span class="t"><span class="str">                And Some More</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2385" class="pln"><span class="n"><a href="#t2385">2385</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2386" class="pln"><span class="n"><a href="#t2386">2386</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2387" class="pln"><span class="n"><a href="#t2387">2387</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2388" class="pln"><span class="n"><a href="#t2388">2388</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2389" class="pln"><span class="n"><a href="#t2389">2389</a></span><span class="t"><span class="str">                void DoSomething();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2390" class="pln"><span class="n"><a href="#t2390">2390</a></span><span class="t"><span class="str">                void DoAnotherThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2391" class="pln"><span class="n"><a href="#t2391">2391</a></span><span class="t"><span class="str">                void DoLastThing();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2392" class="pln"><span class="n"><a href="#t2392">2392</a></span><span class="t"><span class="str">                And Some More</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2393" class="pln"><span class="n"><a href="#t2393">2393</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2394" class="pln"><span class="n"><a href="#t2394">2394</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2395" class="pln"><span class="n"><a href="#t2395">2395</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2396" class="mis show_mis"><span class="n"><a href="#t2396">2396</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2397" class="mis show_mis"><span class="n"><a href="#t2397">2397</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-d'</span><span class="op">,</span> <span class="str">'-o'</span><span class="op">,</span> <span class="str">'test.cogged'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2398" class="mis show_mis"><span class="n"><a href="#t2398">2398</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cogged'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2399" class="pln"><span class="n"><a href="#t2399">2399</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2400" class="run"><span class="n"><a href="#t2400">2400</a></span><span class="t">    <span class="key">def</span> <span class="nam">testDeleteCodeWithDashRFails</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2401" class="mis show_mis"><span class="n"><a href="#t2401">2401</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2402" class="pln"><span class="n"><a href="#t2402">2402</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2403" class="pln"><span class="n"><a href="#t2403">2403</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2404" class="pln"><span class="n"><a href="#t2404">2404</a></span><span class="t"><span class="str">                """</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2405" class="pln"><span class="n"><a href="#t2405">2405</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2406" class="pln"><span class="n"><a href="#t2406">2406</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2407" class="mis show_mis"><span class="n"><a href="#t2407">2407</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2408" class="mis show_mis"><span class="n"><a href="#t2408">2408</a></span><span class="t">        <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">assertRaisesRegex</span><span class="op">(</span><span class="nam">CogUsageError</span><span class="op">,</span> <span class="str">r"^Can't use -d with -r \(or you would delete all your source!\)$"</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2409" class="mis show_mis"><span class="n"><a href="#t2409">2409</a></span><span class="t">            <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">callableMain</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'-d'</span><span class="op">,</span> <span class="str">'test.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2410" class="pln"><span class="n"><a href="#t2410">2410</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2411" class="run"><span class="n"><a href="#t2411">2411</a></span><span class="t">    <span class="key">def</span> <span class="nam">testSettingGlobals</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2412" class="pln"><span class="n"><a href="#t2412">2412</a></span><span class="t">        <span class="com"># Blake Winton contributed a way to set the globals that will be used in</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2413" class="pln"><span class="n"><a href="#t2413">2413</a></span><span class="t">        <span class="com"># processFile().</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2414" class="mis show_mis"><span class="n"><a href="#t2414">2414</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2415" class="pln"><span class="n"><a href="#t2415">2415</a></span><span class="t">            <span class="str">'test.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2416" class="pln"><span class="n"><a href="#t2416">2416</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2417" class="pln"><span class="n"><a href="#t2417">2417</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2418" class="pln"><span class="n"><a href="#t2418">2418</a></span><span class="t"><span class="str">                for fn in fnames:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2419" class="pln"><span class="n"><a href="#t2419">2419</a></span><span class="t"><span class="str">                    cog.outl("void %s();" % fn)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2420" class="pln"><span class="n"><a href="#t2420">2420</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2421" class="pln"><span class="n"><a href="#t2421">2421</a></span><span class="t"><span class="str">                Some Sample Code Here</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2422" class="pln"><span class="n"><a href="#t2422">2422</a></span><span class="t"><span class="str">                //[[[end]]]"""</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2423" class="pln"><span class="n"><a href="#t2423">2423</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2424" class="pln"><span class="n"><a href="#t2424">2424</a></span><span class="t">            <span class="str">'test.out'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2425" class="pln"><span class="n"><a href="#t2425">2425</a></span><span class="t"><span class="str">                // This is my C++ file.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2426" class="pln"><span class="n"><a href="#t2426">2426</a></span><span class="t"><span class="str">                void DoBlake();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2427" class="pln"><span class="n"><a href="#t2427">2427</a></span><span class="t"><span class="str">                void DoWinton();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2428" class="pln"><span class="n"><a href="#t2428">2428</a></span><span class="t"><span class="str">                void DoContribution();</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2429" class="pln"><span class="n"><a href="#t2429">2429</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2430" class="pln"><span class="n"><a href="#t2430">2430</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2431" class="pln"><span class="n"><a href="#t2431">2431</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2432" class="mis show_mis"><span class="n"><a href="#t2432">2432</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2433" class="mis show_mis"><span class="n"><a href="#t2433">2433</a></span><span class="t">        <span class="nam">globals</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2434" class="mis show_mis"><span class="n"><a href="#t2434">2434</a></span><span class="t">        <span class="nam">globals</span><span class="op">[</span><span class="str">'fnames'</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="str">'DoBlake'</span><span class="op">,</span> <span class="str">'DoWinton'</span><span class="op">,</span> <span class="str">'DoContribution'</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2435" class="mis show_mis"><span class="n"><a href="#t2435">2435</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">options</span><span class="op">.</span><span class="nam">bDeleteCode</span> <span class="op">=</span> <span class="key">True</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2436" class="mis show_mis"><span class="n"><a href="#t2436">2436</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">processFile</span><span class="op">(</span><span class="str">'test.cog'</span><span class="op">,</span> <span class="str">'test.cogged'</span><span class="op">,</span> <span class="nam">globals</span><span class="op">=</span><span class="nam">globals</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2437" class="mis show_mis"><span class="n"><a href="#t2437">2437</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertFilesSame</span><span class="op">(</span><span class="str">'test.cogged'</span><span class="op">,</span> <span class="str">'test.out'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2438" class="pln"><span class="n"><a href="#t2438">2438</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2439" class="pln"><span class="n"><a href="#t2439">2439</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2440" class="run"><span class="n"><a href="#t2440">2440</a></span><span class="t"><span class="key">class</span> <span class="nam">ErrorCallTests</span><span class="op">(</span><span class="nam">TestCaseWithTempDir</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2441" class="pln"><span class="n"><a href="#t2441">2441</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2442" class="run"><span class="n"><a href="#t2442">2442</a></span><span class="t">    <span class="key">def</span> <span class="nam">testErrorCallHasNoTraceback</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2443" class="pln"><span class="n"><a href="#t2443">2443</a></span><span class="t">        <span class="com"># Test that cog.error() doesn't show a traceback.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2444" class="mis show_mis"><span class="n"><a href="#t2444">2444</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2445" class="pln"><span class="n"><a href="#t2445">2445</a></span><span class="t">            <span class="str">'error.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2446" class="pln"><span class="n"><a href="#t2446">2446</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2447" class="pln"><span class="n"><a href="#t2447">2447</a></span><span class="t"><span class="str">                cog.error("Something Bad!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2448" class="pln"><span class="n"><a href="#t2448">2448</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2449" class="pln"><span class="n"><a href="#t2449">2449</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2450" class="pln"><span class="n"><a href="#t2450">2450</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2451" class="pln"><span class="n"><a href="#t2451">2451</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2452" class="pln"><span class="n"><a href="#t2452">2452</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2453" class="mis show_mis"><span class="n"><a href="#t2453">2453</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2454" class="mis show_mis"><span class="n"><a href="#t2454">2454</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'error.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2455" class="mis show_mis"><span class="n"><a href="#t2455">2455</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2456" class="mis show_mis"><span class="n"><a href="#t2456">2456</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertEqual</span><span class="op">(</span><span class="nam">output</span><span class="op">,</span> <span class="str">"Cogging error.cog\nError: Something Bad!\n"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2457" class="pln"><span class="n"><a href="#t2457">2457</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2458" class="run"><span class="n"><a href="#t2458">2458</a></span><span class="t">    <span class="key">def</span> <span class="nam">testRealErrorHasTraceback</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2459" class="pln"><span class="n"><a href="#t2459">2459</a></span><span class="t">        <span class="com"># Test that a genuine error does show a traceback.</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2460" class="mis show_mis"><span class="n"><a href="#t2460">2460</a></span><span class="t">        <span class="nam">d</span> <span class="op">=</span> <span class="op">{</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2461" class="pln"><span class="n"><a href="#t2461">2461</a></span><span class="t">            <span class="str">'error.cog'</span><span class="op">:</span> <span class="str">"""\</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2462" class="pln"><span class="n"><a href="#t2462">2462</a></span><span class="t"><span class="str">                //[[[cog</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2463" class="pln"><span class="n"><a href="#t2463">2463</a></span><span class="t"><span class="str">                raise RuntimeError("Hey!")</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2464" class="pln"><span class="n"><a href="#t2464">2464</a></span><span class="t"><span class="str">                //]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2465" class="pln"><span class="n"><a href="#t2465">2465</a></span><span class="t"><span class="str">                //[[[end]]]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2466" class="pln"><span class="n"><a href="#t2466">2466</a></span><span class="t"><span class="str">                """</span><span class="op">,</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2467" class="pln"><span class="n"><a href="#t2467">2467</a></span><span class="t">            <span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2468" class="pln"><span class="n"><a href="#t2468">2468</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2469" class="mis show_mis"><span class="n"><a href="#t2469">2469</a></span><span class="t">        <span class="nam">makeFiles</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2470" class="mis show_mis"><span class="n"><a href="#t2470">2470</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">cog</span><span class="op">.</span><span class="nam">main</span><span class="op">(</span><span class="op">[</span><span class="str">'argv0'</span><span class="op">,</span> <span class="str">'-r'</span><span class="op">,</span> <span class="str">'error.cog'</span><span class="op">]</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2471" class="mis show_mis"><span class="n"><a href="#t2471">2471</a></span><span class="t">        <span class="nam">output</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output</span><span class="op">.</span><span class="nam">getvalue</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2472" class="mis show_mis"><span class="n"><a href="#t2472">2472</a></span><span class="t">        <span class="nam">msg</span> <span class="op">=</span> <span class="str">'Actual output:\n'</span> <span class="op">+</span> <span class="nam">output</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2473" class="mis show_mis"><span class="n"><a href="#t2473">2473</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertTrue</span><span class="op">(</span><span class="nam">output</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"Cogging error.cog\nTraceback (most recent"</span><span class="op">)</span><span class="op">,</span> <span class="nam">msg</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2474" class="mis show_mis"><span class="n"><a href="#t2474">2474</a></span><span class="t">        <span class="nam">self</span><span class="op">.</span><span class="nam">assertIn</span><span class="op">(</span><span class="str">"RuntimeError: Hey!"</span><span class="op">,</span> <span class="nam">output</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2475" class="pln"><span class="n"><a href="#t2475">2475</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2476" class="pln"><span class="n"><a href="#t2476">2476</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t2477" class="pln"><span class="n"><a href="#t2477">2477</a></span><span class="t"><span class="com"># Things not yet tested:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2478" class="pln"><span class="n"><a href="#t2478">2478</a></span><span class="t"><span class="com"># - A bad -w command (currently fails silently).</span>&nbsp;</span><span class="r"></span></p>
</div>
<div id="footer">
    <div class="content">
        <p>
            <a class="nav" href="index.html">&#xab; index</a> &nbsp; &nbsp; <a class="nav" href="https://coverage.readthedocs.io">coverage.py v5.3</a>,
            created at 2020-09-13 15:56 -0400
        </p>
    </div>
</div>
</body>
</html>
